Checking all event logs

by May 9, 2011

What if you would like to get a quick overview of all error events in any event log. Get-EventLog can only query one event log at a time. So, you can use -list to get the names of all event logs and then loop through them.

The next line will get you the latest five error events from all event logs on your system:

$ExistingLogs = Get-EventLog -List 
   foreach ($Logtype in $ExistingLogs){
   Get-EventLog $logtype.log -Newest 5 -EntryType Error 
}

 

 

Twitter This Tip!
ReTweet this Tip!