Home > OM12 Powershell > Get-SCOMAlert–criteria multiple ResolutionStates

Get-SCOMAlert–criteria multiple ResolutionStates

Just saw this in the OpsMgr forums on SystemCenterCentral.com and thought I’d share some  findings from my work with PowerShell and the new cmdlets for OpsMgr 2012.

The question in the forums was is it possible to have multiple ResolutionStates in a –Criteria, the poster never made it clear if the solution they were looking for was for OpsMgr 2012 or not but this is quite easy to do with OpsMgr 2012.

The person who posted asked how to get get alerts with the resolutionstate of 0 and 255. Using  the cmdlet Get-SCOMAlert, using the criteria –resolutionstate you can have more than one value for the resolutionstate just separate the values with a comma.

some quick examples of this would be:

GET-SCOMAlert –resolutionstate 0,255

The next one liner is not very practical, but illustrates the point, will show the alerts with Low, Medium and High severity (aka all alerts).

GET-SCOMAlert –severity 0,1,2

To take this to the extreme, show alerts with Low, Medium and High Severity and Open and Closed alerts for the resolution state.

GET-SCOMAlert –resolutionstate 0,255 –severity 0,1,2

 

Note: When using the –criteria parameter, data is filtered on the SQL server before it is passed back to the PowerShell console, thus lightening up the load on the instance of PowerShell. Using the where-object cmdlet will process the data on the management server.

Advertisements
Categories: OM12 Powershell
  1. No comments yet.
  1. No trackbacks yet.

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

%d bloggers like this: