Recently had a customer ask this question:
I have a group of IIS Websites that match some property.
Can I create a NEW group of Windows Computers, that CONTAIN those same websites that are CONTAINED by the other existing group?
The answer is absolutely.
There are two ways to tackle this. You can create a new group of Windows Computers that contain an IIS Website with the same expression property in the new group with no relationship to the existing group of websites….. OR you can reference the existing group.
This example is the latter – referencing the containment relationship of the Website group.
Here is the simple membership rule:
<MembershipRules> <MembershipRule> <MonitoringClass>$MPElement[Name="Windows!Microsoft.Windows.Computer"]$</MonitoringClass> <RelationshipClass>$MPElement[Name="MSIL!Microsoft.SystemCenter.InstanceGroupContainsEntities"]$</RelationshipClass> <Expression> <Contains> <MonitoringClass>$MPElement[Name="MWIIS2016!Microsoft.Windows.InternetInformationServices.10.0.WebSite"]$</MonitoringClass> <Expression> <Contained> <MonitoringClass>$MPElement[Name="Demo.Group.DefaultWebsites.Group"]$</MonitoringClass> </Contained> </Expression> </Contains> </Expression> </MembershipRule> </MembershipRules>
For reference, here is the entire management pack:
<?xml version="1.0" encoding="utf-8"?><ManagementPack ContentReadable="true" SchemaVersion="2.0" OriginalSchemaVersion="1.1" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <Manifest> <Identity> <ID>Demo.Group</ID> <Version>1.0.0.2</Version> </Identity> <Name>Demo Group</Name> <References> <Reference Alias="MWIIS2016"> <ID>Microsoft.Windows.InternetInformationServices.2016</ID> <Version>10.0.0.0</Version> <PublicKeyToken>31bf3856ad364e35</PublicKeyToken> </Reference> <Reference Alias="MSIL"> <ID>Microsoft.SystemCenter.InstanceGroup.Library</ID> <Version>7.5.8501.0</Version> <PublicKeyToken>31bf3856ad364e35</PublicKeyToken> </Reference> <Reference Alias="System"> <ID>System.Library</ID> <Version>7.5.8501.0</Version> <PublicKeyToken>31bf3856ad364e35</PublicKeyToken> </Reference> <Reference Alias="SC"> <ID>Microsoft.SystemCenter.Library</ID> <Version>10.0.0.0</Version> <PublicKeyToken>31bf3856ad364e35</PublicKeyToken> </Reference> <Reference Alias="Windows"> <ID>Microsoft.Windows.Library</ID> <Version>7.5.8501.0</Version> <PublicKeyToken>31bf3856ad364e35</PublicKeyToken> </Reference> </References> </Manifest> <TypeDefinitions> <EntityTypes> <ClassTypes> <ClassType ID="Demo.Group.DefaultWebsites.Group" Accessibility="Public" Abstract="false" Base="MSIL!Microsoft.SystemCenter.InstanceGroup" Hosted="false" Singleton="true" Extension="false" /> <ClassType ID="Demo.Group.Computers.That.Contain.Websites.In.Another.Group.Group" Accessibility="Public" Abstract="false" Base="MSIL!Microsoft.SystemCenter.InstanceGroup" Hosted="false" Singleton="true" Extension="false" /> </ClassTypes> </EntityTypes> </TypeDefinitions> <Monitoring> <Discoveries> <Discovery ID="Demo.Group.DefaultWebsites.Group.Discovery" Enabled="true" Target="Demo.Group.DefaultWebsites.Group" ConfirmDelivery="false" Remotable="true" Priority="Normal"> <Category>Discovery</Category> <DiscoveryTypes> <DiscoveryRelationship TypeID="MSIL!Microsoft.SystemCenter.InstanceGroupContainsEntities" /> </DiscoveryTypes> <DataSource ID="GroupPopulationDataSource" TypeID="SC!Microsoft.SystemCenter.GroupPopulator"> <RuleId>$MPElement$</RuleId> <GroupInstanceId>$MPElement[Name="Demo.Group.DefaultWebsites.Group"]$</GroupInstanceId> <MembershipRules> <MembershipRule> <MonitoringClass>$MPElement[Name="MWIIS2016!Microsoft.Windows.InternetInformationServices.10.0.WebSite"]$</MonitoringClass> <RelationshipClass>$MPElement[Name="MSIL!Microsoft.SystemCenter.InstanceGroupContainsEntities"]$</RelationshipClass> <Expression> <RegExExpression> <ValueExpression> <Property>$MPElement[Name="System!System.Entity"]/DisplayName$</Property> </ValueExpression> <Operator>ContainsSubstring</Operator> <Pattern>default</Pattern> </RegExExpression> </Expression> </MembershipRule> </MembershipRules> </DataSource> </Discovery> <Discovery ID="Demo.Group.Computers.That.Contain.Websites.In.Another.Group.Group.Discovery" Enabled="true" Target="Demo.Group.Computers.That.Contain.Websites.In.Another.Group.Group" ConfirmDelivery="false" Remotable="true" Priority="Normal"> <Category>Discovery</Category> <DiscoveryTypes> <DiscoveryRelationship TypeID="MSIL!Microsoft.SystemCenter.InstanceGroupContainsEntities" /> </DiscoveryTypes> <DataSource ID="GroupPopulationDataSource" TypeID="SC!Microsoft.SystemCenter.GroupPopulator"> <RuleId>$MPElement$</RuleId> <GroupInstanceId>$MPElement[Name="Demo.Group.Computers.That.Contain.Websites.In.Another.Group.Group"]$</GroupInstanceId> <MembershipRules> <MembershipRule> <MonitoringClass>$MPElement[Name="Windows!Microsoft.Windows.Computer"]$</MonitoringClass> <RelationshipClass>$MPElement[Name="MSIL!Microsoft.SystemCenter.InstanceGroupContainsEntities"]$</RelationshipClass> <Expression> <Contains> <MonitoringClass>$MPElement[Name="MWIIS2016!Microsoft.Windows.InternetInformationServices.10.0.WebSite"]$</MonitoringClass> <Expression> <Contained> <MonitoringClass>$MPElement[Name="Demo.Group.DefaultWebsites.Group"]$</MonitoringClass> </Contained> </Expression> </Contains> </Expression> </MembershipRule> </MembershipRules> </DataSource> </Discovery> </Discoveries> </Monitoring> <LanguagePacks> <LanguagePack ID="ENU" IsDefault="false"> <DisplayStrings> <DisplayString ElementID="Demo.Group"> <Name>Demo Group</Name> </DisplayString> <DisplayString ElementID="Demo.Group.DefaultWebsites.Group"> <Name>Default Websites Group</Name> </DisplayString> <DisplayString ElementID="Demo.Group.DefaultWebsites.Group.Discovery"> <Name>Default Websites Group Discovery</Name> </DisplayString> <DisplayString ElementID="Demo.Group.Computers.That.Contain.Websites.In.Another.Group.Group"> <Name>Windows Computers that Contain a Website Contained by another Group</Name> </DisplayString> <DisplayString ElementID="Demo.Group.Computers.That.Contain.Websites.In.Another.Group.Group.Discovery"> <Name>Windows Computers that Contain a Website Contained by another Group Discovery</Name> </DisplayString> </DisplayStrings> </LanguagePack> </LanguagePacks> </ManagementPack>