Thursday 19 July 2012

LttP: Powershell Games 2012 - Beginner Event 7

Beginner Event 7 had me delving into the "new" logging system and scratching my head with regards to what a "hidden log" might be.

I've taken it to mean a Debug / Analytic log, and as such my "entry" follows:

Get-WinEvent -ListLog * -Force -EA 0 | Where-Object {($_.IsEnabled -eq $true) -and ($_.RecordCount)} | Sort-Object RecordCount -Descending | Format-Table -Property "LogName","RecordCount" -AutoSize -Wrap

Time to check the expert blog...

UPDATE:

It would appear I didn't need the "-Force" according to the expert, and also I could loose the "-eq $true" from my Where-Object clause (as IsEnabled is already a boolean.)

No comments: