Useful PowerShell Commands

Here are a few SCOM PowerShell commands that might come in useful. Just replace the ID here with the ID of the object you are interested in.

How to open SCOM PowerShell

Open the Operations Manager Shell: Start > Microsoft System Center > Operations Manager Shell.

To get property names for use with Scope Criteria

The Scope Criteria needs to use the SCOM internal name of the property, rather than the display name.

To get a full list you can run the following PowerShell script:

Get-SCOMClassInstance -Name "hostname.dnsdomain" | Format-List

Replacing hostname.dnsdomain with your details, for example, server1.domain.local

There is no need to qualify the property with the type name such as [Microsoft.Windows.Computer]

To query the RuleId

Get-SCOMRule -Id b603ba1e-c5ec-221e-e9e3-cf2098e7bdbd | Format-List

To query the MonitorId

Get-SCOMMonitor -Id 32c755df-94b4-5f2e-62b7-0fef16758699 | Format-List

To get details such as the DisplayName of an Object

Get-SCOMMonitoringObject -Id 6f7e3306-beeb-2996-3795-7c1eafb925b8 | Format-List

or

get-scomclass -id 2c2de865-0cd3-a6b8-51a5-3dabf7b48d4e | Format-List

If the object exists a list of information will be returned. If the object does not exist nothing will be returned.

To get details of a group

Get-SCOMGroup -Id d0720ebb-670a-3586-9d1c-a10246489de4

How to find the SCOM ID of an object or group

You can use SCOM PowerShell commands to find the SCOM ID of objects and groups as shown below, or you can very easily find the SCOM IDs in SquaredUp DS, see How to find the SCOM ID of an object or group.

Get-SCOMMonitoringObject -DisplayName "Hong Kong" | select id

This can be used for any object (or group). To list all groups and their SCOM IDs:

Get-SCOMGroup | select displayName,Id

Was this article helpful?


Have more questions or facing an issue?