How to use criteria when scoping objects
This article explains how to filter objects using advanced criteria when scoping a tile.
For more information about the basic scoping options see How to scope tiles.
For information about scoping alerts see How to use criteria when scoping alerts.
Scope Criteria
When configuring the scope of a tile, the Criteria option under Scope > Advanced allows you to more precisely filter objects displayed in the tile by creating a specific expression to refine data returned from SCOM.
For example, Name LIKE '%server%'
would return all objects with server
in their key properties.
Useful operators
The table below shows some of the common operators and wildcards you can use when defining a criteria expression.
Operator | Effect |
---|---|
= | equals |
!= | does not equal |
< | less than |
> | greater than |
LIKE | simple pattern matching |
% | matches any number of characters when used with LIKE |
_ | matches any single character when used with LIKE |
MATCHES | full .net regular expression matching |
AND | test if two conditions are both true |
OR | test if either of two conditions are true |
IS NULL | if the property does not contain a value |
IS NOT NULL | if the property does contain a value |
See the following Microsoft pages for more information about the syntax and a full list of and operators:
Object Properties
The property names use the SCOM internal name, not the display name, and the property names are case sensitive, i.e. it must be DisplayName, not displayname; HealthState not Healthstate. There is no need to qualify the property with the type name such as [Microsoft.Windows.Computer]
For a list of generic property names valid for all objects see MonitoringObject Properties.
To get a full list for a particular object you can also run the following PowerShell script:
Get-SCOMClassInstance -Name "hostname.dnsdomain" | Format-List
Replacing hostname.dnsdomain with your details, for example, server1.domain.local
Useful properties
Property Name | Values |
---|---|
Name | The objects key properties, concatenated with a ; |
HealthState | HealthStates are (see How to use the Status tile):1 = Healthy2 = Warning3 = Critical 0 = UninitializedNull for objects an empty value. In SCOM this is objects with no health state specified in SCOM (uninitialized), a gray health state icon with a question mark, because they have never had a health state. |
IsAvailable | 'true' or 1 if the object's parent health service is responding to SCOM'false' or 0 for objects that are offline/unmonitored |
InMaintenanceMode | 'true' or 1 if the object is in Maintenance mode'false' or 0'null' for objects which have never been put into Maintenance mode and have an empty InMaintenanceMode value. |
For example, in Scope > Advanced Criteria type the following to show all healthy objects:
HealthState = 1
Null
Some properties may be blank, or have no value, in SCOM. For example, computers that have not yet had a health state, or not ever been put into Maintenance mode. To show objects with a blank value you must use IS null
or IS NOT null
.
When using null
you must use IS null
or IS NOT null
, it will not work with operators such as = null
.
To show ALL gray uninitialised objects:
HealthState IS NULL OR HealthState = 0
To show computers that are not in Maintenance Mode use:
InMaintenanceMode IS NULL OR InMaintenanceMode = 'false'
Example Criteria
The following table provides you with some example filters that are commonly used by dashboard authors.
Objects you would like to see | Criteria |
---|---|
Objects with particular text in their name | DisplayName like '%Server1%' |
Objects starting with a particular string | DisplayName like 'test%' |
All objects in maintenance mode | InMaintenanceMode = 'TRUE' |
Only healthy objects | HealthState = 1 |
Objects with a health state in SCOM of 0, an unknown health state (uninitialized), a gray health state icon with a question mark. | HealthState = 0 |
Objects that are not healthy | HealthState != 1 |
Objects in critical state | HealthState = 3 |
Objects in critical or warning state | HealthState = 2 or HealthState = 3 |
To show all gray uninitialised objects | HealthState = 0 OR HealthState IS NULL |
All objects not in maintenance mode | InMaintenanceMode != 'TRUE' |
Objects where the parent agent is offline | IsAvailable='false' |
Objects that are offline, in maintenance or state unknown | IsAvailable='false' OR InMaintenanceMode=1 OR HealthState=0 |
Computers with a particular OS | OSVersion = '6.3.9600' |
List objects by name and filter by HealthState | (Name like '%Server3%' OR Name like '%Server4%' OR Name like '%Server2%') AND HealthState=3 |
List objects by SCOM Id and filter by HealthState | Id IN ('7021174b-9e5d-5fbf-878a-42b9f0bf6f4a', '9bd4a1cc-f07a-0e36-b37d-d9ee974e0f3c') AND HealthState=3 |
Exclude object from the Group specified | DisplayName not like '%server3%' |
Exclude objects from the Group specified | (DisplayName NOT LIKE '%server3%') AND (DisplayName NOT LIKE '%server4%') |
List Objects by Name
To specify a list of objects by Name you should specify their Class and the following Criteria:
Name like '%Server3%' OR Name like '%Server4%' OR Name like '%Server2%'
You can filter the list by adding to the Criteria (for example, objects from a list that must also be showing as critical):
(Name like '%Server3%' OR Name like '%Server4%' OR Name like '%Server2%') AND HealthState=3
List Objects by Id
To specify a list of objects by SCOM Id you should use a Class and the following Criteria:
Id IN ('7021174b-9e5d-5fbf-878a-42b9f0bf6f4a', '9bd4a1cc-f07a-0e36-b37d-d9ee974e0f3c')
You can filter the list by adding to the Criteria (for example, objects from a list that must also be showing as critical):
Id IN ('7021174b-9e5d-5fbf-878a-42b9f0bf6f4a', '9bd4a1cc-f07a-0e36-b37d-d9ee974e0f3c') AND HealthState=3
See How to find the SCOM ID of an object or group to determine the Id of an object.
Alternatively you can create a group in SCOM containing the objects you have previously been listing, and then use the Group option.
Hide unmonitored objects
You can hide objects that are unmonitored from being displayed by using the not equals operator and the HealthState property:
HealthState != 0
Mustache editor
In Dashboard Server v4.7 and above you can use the mustache editor with Criteria on perspectives.
For example, on a perspective you can insert the {{displayName}} of the object being viewed.
Clicking the {{}} button or typing {{
brings up a helpful picker which shows all the properties of your selected objects, along with sample values.
Once the mustache helper is displayed, the list of properties will automatically filter based on what you type, allowing you to quickly find a property using a partial name or likely term. Clicking an item in the list will automatically insert that property and complete the mustache.
Property names are case-sensitive and should be written as they appear in the mustache helper (e.g. displayName
not DisplayName
).
The mustache helper button will only show when viewing the Criteria field on a perspective. This is because mustaches are processed against the perspective object not the scope objects.