Menu Close

Creating Groups of Windows Computers that CONTAIN an application or application property

In SCOM we often need to create groups of Windows Computer objects, for using Maintenance Mode, Views, Notifications, Overrides, etc.  A common need is to create a group of Windows Computers that host a specific application, like SQL, or a custom application class.  This cannot easily be done using the Console UI.  But here are some examples you can use to accomplish that.

I have a fragment example that does exactly this, posted here:  Class.Group.WindowsComputers.mpx

For beginners who aren’t using fragments yet, you can do some fairly simple XML replacements to get started.  Create a Group using the Console, and give it some simple expression for dynamic membership like Object is Windows Computer AND Name equals “foo”:



It doesn’t matter what you pick, because we will replace it.

Export this management pack where you created the group, and open the XML using Notepad++ (or your favorite XML editor)

Go to the group’s membership rule in the discovery.  Here is mine that I just made:

<MembershipRules> <MembershipRule> <MonitoringClass>$MPElement[Name="MicrosoftWindowsLibrary7585010!Microsoft.Windows.Computer"]$</MonitoringClass> <RelationshipClass>$MPElement[Name="MicrosoftSystemCenterInstanceGroupLibrary7585010!Microsoft.SystemCenter.InstanceGroupContainsEntities"]$</RelationshipClass> <Expression> <SimpleExpression> <ValueExpression> <Property>$MPElement[Name="MicrosoftWindowsLibrary7585010!Microsoft.Windows.Computer"]/PrincipalName$</Property> </ValueExpression> <Operator>Equal</Operator> <ValueExpression> <Value>foo</Value> </ValueExpression> </SimpleExpression> </Expression> </MembershipRule> </MembershipRules>

If you read the membership rule, you can see the MonitoringClass is Windows Computer.  The expression is pretty much  “Principal Name = foo”.

We can change this to something like “Windows Computers that CONTAINS another application” like the following example:

<MembershipRule> <MonitoringClass>$MPElement[Name="MicrosoftWindowsLibrary7585010!Microsoft.Windows.Computer"]$</MonitoringClass> <RelationshipClass>$MPElement[Name="MicrosoftSystemCenterInstanceGroupLibrary7585010!Microsoft.SystemCenter.InstanceGroupContainsEntities"]$</RelationshipClass> <Expression> <Contains> <MonitoringClass>$MPElement[Name="Azure.VM.Class"]$</MonitoringClass> </Contains> </Expression> </MembershipRule>

Now – the example above assumes the groups is being created into the SAME management pack that also contains the class “Azure.VM.Class”.  If you are referencing a management pack class from a different MP, that MP must be sealed so that we can reference it properly, such as this example:

<MembershipRule> <MonitoringClass>$MPElement[Name="MicrosoftWindowsLibrary7585010!Microsoft.Windows.Computer"]$</MonitoringClass> <RelationshipClass>$MPElement[Name="MicrosoftSystemCenterInstanceGroupLibrary7585010!Microsoft.SystemCenter.InstanceGroupContainsEntities"]$</RelationshipClass> <Expression> <Contains> <MonitoringClass>$MPElement[Name="AzureVMMP!Azure.VM.Class"]$</MonitoringClass> </Contains> </Expression> </MembershipRule>

This requires that my Manifest section have this matching reference for “AzureVMMP” alias:

<References> <Reference Alias="SystemCenter"> <ID>Microsoft.SystemCenter.Library</ID> <Version>7.0.8448.6</Version> <PublicKeyToken>31bf3856ad364e35</PublicKeyToken> </Reference> <Reference Alias="MicrosoftWindowsLibrary7585010"> <ID>Microsoft.Windows.Library</ID> <Version>7.5.8501.0</Version> <PublicKeyToken>31bf3856ad364e35</PublicKeyToken> </Reference> <Reference Alias="MicrosoftSystemCenterInstanceGroupLibrary7585010"> <ID>Microsoft.SystemCenter.InstanceGroup.Library</ID> <Version>7.5.8501.0</Version> <PublicKeyToken>31bf3856ad364e35</PublicKeyToken> </Reference> <Reference Alias="AzureVMMP"> <ID>Azure.VM</ID> <Version></Version> <PublicKeyToken>yoursealingkeyguidhere</PublicKeyToken> </Reference> </References>


Now, what if I need an example of how to match on a specific property of an application class?  Here is an example where I want a Group of Windows Computers that Contain an Azure VM class instance, that also match a specific class property (Called “Tags” in this example) on the VM class:

<MembershipRule> <MonitoringClass>$MPElement[Name="MicrosoftWindowsLibrary7585010!Microsoft.Windows.Computer"]$</MonitoringClass> <RelationshipClass>$MPElement[Name="MicrosoftSystemCenterInstanceGroupLibrary7585010!Microsoft.SystemCenter.InstanceGroupContainsEntities"]$</RelationshipClass> <Expression> <Contains> <MonitoringClass>$MPElement[Name="AzureVMMP!Azure.VM.Class"]$</MonitoringClass> <Expression> <RegExExpression> <ValueExpression> <Property>$MPElement[Name="AzureVMMP!Azure.VM.Class"]/Tags$</Property> </ValueExpression> <Operator>MatchesRegularExpression</Operator> <!-- Valid Operators are MatchesWildcard, DoesNotMatchWildcard, ContainsSubstring, DoesNotContainSubstring, MatchesRegularExpression, DoesNotMatchRegularExpression --> <Pattern>^SomeStuff*</Pattern> </RegExExpression> </Expression> </Contains> </Expression> </MembershipRule>


This is pretty cool!  What if I also want to add Health Service Watcher objects to this group, for any Windows Computer that is also a member?  This will help me scope notifications or views to include Heartbeat failures and computer down alerts.  For that, we simply add an additional membership rule to contain the Health Service Watchers for Computers that matched on the first membership rule:

<MembershipRules> <MembershipRule> <MonitoringClass>$MPElement[Name="MicrosoftWindowsLibrary7585010!Microsoft.Windows.Computer"]$</MonitoringClass> <RelationshipClass>$MPElement[Name="MicrosoftSystemCenterInstanceGroupLibrary7585010!Microsoft.SystemCenter.InstanceGroupContainsEntities"]$</RelationshipClass> <Expression> <Contains> <MonitoringClass>$MPElement[Name="AzureVMMP!Azure.VM.Class"]$</MonitoringClass> <Expression> <RegExExpression> <ValueExpression> <Property>$MPElement[Name="AzureVMMP!Azure.VM.Class"]/Tags$</Property> </ValueExpression> <Operator>MatchesRegularExpression</Operator> <Pattern>^SomeStuff*</Pattern> </RegExExpression> </Expression> </Contains> </Expression> </MembershipRule> <MembershipRule> <MonitoringClass>$MPElement[Name="SystemCenter!Microsoft.SystemCenter.HealthServiceWatcher"]$</MonitoringClass> <RelationshipClass>$MPElement[Name="MicrosoftSystemCenterInstanceGroupLibrary7585010!Microsoft.SystemCenter.InstanceGroupContainsEntities"]$</RelationshipClass> <Expression> <Contains> <MonitoringClass>$MPElement[Name="SystemCenter!Microsoft.SystemCenter.HealthService"]$</MonitoringClass> <Expression> <Contained> <MonitoringClass>$MPElement[Name="MicrosoftWindowsLibrary7585010!Microsoft.Windows.Computer"]$</MonitoringClass> <Expression> <Contained> <MonitoringClass>$Target/Id$</MonitoringClass> </Contained> </Expression> </Contained> </Expression> </Contains> </Expression> </MembershipRule> </MembershipRules>

The hardest part of all of this – if making sure your references match up, as they can vary between management packs depending on where they were created.  In the examples above, since I created the MP in the SCOM console, my Manifest Reference to the Microsoft.Windows.Library is: “MicrosoftWindowsLibrary7585010”.  However, in other MP’s it might be just “Windows”.  The reference in the examples above for the Microsoft.SystemCenter.Library is “SystemCenter” but it is often just “SC”.  So make sure you check and modify your reference aliases as needed.  Sometimes you have to manually add a reference in your MP’s to an external sealed MP.

If you use my fragments, and visual studio or Silect MP author pro, this is a lot easier and the UI gives you a bit more control.

If you are just getting started with groups, or looking for other types of groups – these examples may help:

What is a group anyway?

Authoring SCOM groups – from simple to complex

Creating custom dynamic computer groups based on registry keys on agents

Quick tip – using regular expressions in a dynamic group

Creating a Group based on OU (Organizational Unit) in Active Directory

Creating Groups of Computers based on Time Zone

How to create a group of objects, that are CONTAINED by some other group

How to create a group of all Windows Computers that are NOT a member of another group

Creating Groups of Health Service Watcher Objects based on other Groups

How to create a SCOM group from an Active Directory Computer Group

How to create a SCOM group from a SQL CMDB Query

Making groups of logical disks – an example from simple to advanced

How to create a SCOM Group of Disks that are related to an Application using CONTAINED and CONTAINS

Part 7: Use VSAE fragments to add custom Groups to your MP


    • Kamil

      To clarify my needs:
      I need a Group of Windows Computers and VM Objects, where there is a Keyword in the Description Field of the VM Object.

Leave a Reply

Your email address will not be published.