Groups are something that took me a while to get my head round. You can create a group with one line of code (Plus display string obviously), however its useless without a discovery. Luckily the discovery will use the same expression format as a normal discovery, so it’s actually not that much of a learning curve.
Below is used to define the group, in this cased its called “Kofax.Capture.Databases”, as you have probably guessed, it’s going to hold the databases that are used by the Kofax system.
<ClassType ID="Kofax.Capture.Databases" Base="System!System.Group" Accessibility="Public" Abstract="false" Hosted="false" Singleton="true" />
Looking at this app, there are two different naming conventions for databases. So I’m going to use an “OR” in my discovery criteria.
<Expression>
<Or>
<Expression>
<SimpleExpression>
<ValueExpression>
<Property>$MPElement[Name="MSL!Microsoft.SQLServer.Database"]/DatabaseName$</Property>
</ValueExpression>
<Operator>Equal</Operator>
<ValueExpression>
<Value>Monitor</Value>
</ValueExpression>
</SimpleExpression>
</Expression>
<Expression>
<RegExExpression>
<ValueExpression>
<Property>$MPElement[Name="MSL!Microsoft.SQLServer.Database"]/DatabaseName$</Property>
</ValueExpression>
<Operator>ContainsSubstring</Operator>
<Pattern>Kofax</Pattern>
</RegExExpression>
</Expression>
</Or>
</Expression>
I’m also using two different types of expression, a Simple and a RegEx expression. Normally I would use a simple expression where I want to match a string exactly and a RegEx expression where I’m looking to match part of a string. (I.e. simple for “Database” and RegEx for “*ataba*”).
To add these to an existing solution, you will need to
<ManagementPackFragment SchemaVersion="1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<TypeDefinitions>
<EntityTypes>
<ClassTypes>
<ClassType ID="Kofax.Capture.Databases" Base="System!System.Group" Accessibility="Public" Abstract="false" Hosted="false" Singleton="true" />
</ClassTypes>
</EntityTypes>
</TypeDefinitions>
<LanguagePacks>
<LanguagePack ID="ENU" IsDefault="true">
<DisplayStrings>
<DisplayString ElementID="Kofax.Capture.Databases">
<Name>Kofax Databases</Name>
<Description>Kofax Capture Databases</Description>
</DisplayString>
</DisplayStrings>
</LanguagePack>
</LanguagePacks>
</ManagementPackFragment>
Save it and resolve any syntax errors (should be fine)
Add a “Discovery” fragment, if you don’t already have one, then add a new a new template inside this.
In the properties box on the right, set the target to be the name of your group. If your new group isn’t listed, make sure you have saved the project
Then give the discovery an ID, I always use something like “Populate.Databases”, as this is a population discovery
Then add a display name
You can set the “Discovery Relationship”, this is the containment relation. I show how to setup containment relationships [Here][1]
You need to pick the “Data Source Type ID”. This should be “SC!Microsoft.SystemCenter.GroupPopulator”. To use this, you need to make sure that you have added “Microsoft.SystemCenter.InstanceGroup.Library” as a reference. It can be found in the references folder that comes with VSAE
the last step is to add the code of the “Data source Configuration”. You will need to enter the whole of the below (Amend to your purposes) between the configuration tags
<RuleId>$MPElement$</RuleId>
<GroupInstanceId>$Target/Id$</GroupInstanceId>
<MembershipRules>
<MembershipRule>
<MonitoringClass>$MPElement[Name="MSL!Microsoft.SQLServer.Database"]$</MonitoringClass>
<RelationshipClass>$MPElement[Name="Kofax.Capture.DatabasesContainsDatabase"]$</RelationshipClass>
<Expression>
<Or>
<Expression>
<SimpleExpression>
<ValueExpression>
<Property>$MPElement[Name="MSL!Microsoft.SQLServer.Database"]/DatabaseName$</Property>
</ValueExpression>
<Operator>Equal</Operator>
<ValueExpression>
<Value>Monitor</Value>
</ValueExpression>
</SimpleExpression>
</Expression>
<Expression>
<RegExExpression>
<ValueExpression>
<Property>$MPElement[Name="MSL!Microsoft.SQLServer.Database"]/DatabaseName$</Property>
</ValueExpression>
<Operator>ContainsSubstring</Operator>
<Pattern>Kofax</Pattern>
</RegExExpression>
</Expression>
</Or>
</Expression>
</MembershipRule>
</MembershipRules>
You can now build and deploy your MP. It shouldn’t take long to add the databases to this group if they have already been discovered.
Let me know if you need any more detail or if the above isn’t clear Good luck!!