Advertisements

Blog Archives

Get-EventLog – Use Powershell to filter Event Logs

Use Powershell to locate the Errors from Event Logs on Servers

Powershell is indeed a powerful tool. But using it productively for the real world challenges is the key. With Powershell we can achieve a pro-active approach to IT Management within an organisation. Lets take a scenario; say we need to audit the servers regularly to check for System and Application Errors in the EventLogs

Open Powershell as an Administrator and type below command

Get-EventLog -Logname System -EntryType Error -Newest 5 -Computername Server1,Server2,Server3,Server4  | export-csv c:\plogs\errors.csv

Get-EventLog -Logname Application -EntryType Error -Newest 5 -Computername Server1,Server2,Server3,Server4  | export-csv c:\plogs\errors.csv

The above commands extract the latest 5 System and Application errors from the EventLogs of all the specified Servers. You can run this script through a Simple Task Scheduler for daily information

Advertisements