February 26th, 2013

PowerTip: Find the Number of Entries in Event Logs

Doctor Scripto
Scripter

PowerTip: Find the Number of Entries in Event Logs

Summary:  Use Windows PowerShell to find the number of entries in all event logs and ETL logs?

 Hey, Scripting Guy! Question How can you use Windows PowerShell to show how many entries exist in all traditional event logs as well as ETL logs?

Hey, Scripting Guy! Answer Use the Get-WinEvent cmdlet and pass a wild card to the –ListLog parameter. Sort the recordcount in a descending manner, and select both the recordcount and logname. To tighten up the output, pipe the results to the Format-Table cmdlet and use –autosize.

Get-WinEvent -ListLog * -ea 0 | sort recordcount -Descending |

select recordcount, logname | Format-Table -auto

Author

The "Scripting Guys" is a historical title passed from scripter to scripter. The current revision has morphed into our good friend Doctor Scripto who has been with us since the very beginning.

0 comments

Discussion are closed.