Eventlogs: Unterschied zwischen den Versionen

Aus Wiki-WebPerfect
Wechseln zu: Navigation, Suche
K
Zeile 15: Zeile 15:
 
==== Eventlog mittels HashTable filtern ====
 
==== Eventlog mittels HashTable filtern ====
 
<source lang="powershell">Get-WinEvent -FilterHashTable @{LogName ="Microsoft-Windows-Hyper-V-VMMS-Admin"} | ? {$_.LevelDisplayName -eq "Error"} | ? {$_.TimeCreated -ge ((get-date).AddDays(-2))}</source>
 
<source lang="powershell">Get-WinEvent -FilterHashTable @{LogName ="Microsoft-Windows-Hyper-V-VMMS-Admin"} | ? {$_.LevelDisplayName -eq "Error"} | ? {$_.TimeCreated -ge ((get-date).AddDays(-2))}</source>
 +
 +
==== Eventlog-Eintrag erstellen (Dummy) ====
 +
<source lang="powershell">Write-EventLog –LogName System –Source “Microsoft-Windows-FailoverClustering” –EntryType Information –EventID 5121 -message "Manual"</source>
  
  

Version vom 10. August 2017, 08:24 Uhr

Standard EventLogs (Windows Logs)

Letze 10 Application EventLogs anzeigen

Get-EventLog -Newest 10 -LogName "Application"

Spezielle EventLogs (Application and Services Logs)

Beispiel Microsoft-Windows-Hyper-V-VMMS EventLogs

Get-WinEvent -ComputerName <Hostname> -ProviderName 'Microsoft-Windows-Hyper-V-VMMS' -MaxEvents 10 | ft -Property TimeCreated, MachineName, Id, LevelDisplayName, Message


Beispiele / Tipps

Beispiel Microsoft-Windows-Hyper-V-VMMS EventLogs der letzten zwei Tage

Get-WinEvent -ComputerName <Hostname> -ProviderName 'Microsoft-Windows-Hyper-V-VMMS' | ? {$_.LevelDisplayName -eq "Error"} | ? {$_.TimeCreated -ge ((get-date).AddDays(-2))}

Eventlog mittels HashTable filtern

Get-WinEvent -FilterHashTable @{LogName ="Microsoft-Windows-Hyper-V-VMMS-Admin"} | ? {$_.LevelDisplayName -eq "Error"} | ? {$_.TimeCreated -ge ((get-date).AddDays(-2))}

Eventlog-Eintrag erstellen (Dummy)

Write-EventLog –LogName System –Source “Microsoft-Windows-FailoverClustering” –EntryType Information –EventID 5121 -message "Manual"