Advertisements

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

Posted on February 27, 2014, in Powershell and tagged , , . Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: