Operations Manager cmdlet: Get-Alert examples
A few more examples of the Get-Alert cmdlet for Operations Manager 2007. These were inspired from the Virtual User group meeting. Something Marco Shaw showed in his Operations Manager powershell demo.
To get a count of all Informational alerts
>(get-alert -criteria 'Severity = ''0''').count
1150
To get a count of all Warning alerts
>(get-alert -criteria 'Severity = ''1''').count
3767
To get a count of all Critical alerts
>(get-alert -criteria 'Severity = ''2''').count
1944
To get a count of all new information alerts
>(get-alert -criteria 'ResolutionState = ''0'' AND Severity = ''0''').count
65
To get a count of all new Warning Alerts:
>(get-alert -criteria 'ResolutionState = ''0'' AND Severity = ''1''').count
344
To get a count of all new Critical Alerts:
>(get-alert -criteria 'ResolutionState = ''0'' AND Severity = ''2''').count
144
Example of criteria being case sensitive error:
>(get-alert -criteria 'Resolutionstate = ''0'' AND Severity = ''1''').count
Get-Alert : A property name in the 'Criteria' parameter is unknown.
At line:1 char:11
+ (get-alert <<<< -criteria 'Resolutionstate = ''0'' AND Severity = ''1''').count