#powershell One-liner Code: Event Logs Overview

One liner #powershell code to list the frequency of most recent events generated for the specified EventViewer log file type.

( can you spot an “error”? )
Get-EventLog system |
Group-Object EntryType |
% `
-Begin { "-begin '$($_.name)'" } `
-Process {
"-process '$($_.name)'";
$_.group | group EventId |
sort count -desc |
select count, name,
@{l='TimeGenerated';e={$_.group[0].TimeGenerated}},
@{l='Message';e={$_.group[0].Message}}} |
ft -au

Bookmark the permalink.

Leave a Reply