Extract Alerts to csv file according to resolution state and severity

Powershell to extract alerts and put them in a csv file according to resolution state and severity.
Values to use……..
Resolution State              Severity Values for Alerts

0       =   New                          0 = INFORMATIONAL
255   =   Closed                      1 = WARNING 
                                                 2=  CRITICAL

get-alert -criteria ‘ResolutionState=0 AND Severity>=2’ | select Name,ResolutionState,TimeRaised | export-csv c:\CriticalAlerts.csv

ALTERNATIVELY USE THIS POWERSHELL TO GET ALERTS GENERATED WITHIN LAST 30 MINS (you can change values to suit)

Get-Alert -criteria ‘Severity = “2” AND ResolutionState=”0″‘ |where-object {$_.TimeRaised -gt (get-date).addminutes(-30).ToLongDateString()} | export-csv c:\NewAlerts.csv

Advertisements
This entry was posted in Powershell for SCOM and tagged , , , , , , , , , , , , , , . Bookmark the permalink.

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s