Extending Windows Computer Class using Visual Studio Authoring Extensions (VSAE)

We can utilize Operations Manager Console to create attributes to existing classes (if you havent met Kevin’s great blog with a real life scenario please do so). Using SCOM console is great but when you need to add only ONE Property.

Once you need a second or third property, advanced authoring MP is required. The real life case  might be sth like;

“We want to create Views, set Overrides , set Notifications for specific to the Departmant that owns the Server and/or for the test environments. ”

I wanted to take this scenario as an opportunity to use VSAE for authoring.


We will achieve this via deploying a registry key (during server provisioning, via a startup script – whatever you prefer) and then extending Windows computer class based on this registry key.


Once we have the registry entries deployed time to author the MP but before start authoring followings are required

  1. Visual Studio 2010 Professional
  2. Vsual Studio Authoring Extensions (http://www.microsoft.com/en-us/download/details.aspx?id=30169)

Basic things to know for a kick start VSAE Authoring

Management Pack Versions; There are two options while creating a Project.

  1. Opearations Manager 2012 Add-On Management Pack; This is for only OM12 (Schema is 2.0). Use this Project if you are going to utilise the new Schema (widgets etc) in your MP and you wont be needing this MP to be imported to 2007 management group.
  2. Operations Manager Core Monitoring Management Pack; This is valid for both versions (Schema is 1.0) 2007 and 2012. Use this Project if you wont need the widgets etc in your mp. (In our scenario in this post we will use the this one)

MP Fragments; These are part of the MP and are XML containining the class/discovery (for our case we will only need a class and a discovery) definitions. These fragments (we may call them small part of MPs) are merged into the resulting MP XML (or even the .mp file – VSAE is capable of providing the seal management pack) that can be found in the bin\debug folder of the Project). MP Fragements are .mpx files those are added to the solution and contains the actual mp xml parts within the <ManagementPackFragment></ManagmentPackFragment>.


Management Pack Templates; There are two types and we will be using the simple one.

  1. Simple Templates; These are basic xml skeletons (skelaton ready mp fragments) and you need to edit the xml to complete the element. We will be using Class Simple Template to create our extended Windows.Computer class in “Computer Class.Mpx”
  2. Advanced Templates; We wont be using these ones in this sample but just for simple explanation, these are half ui – half xml templates. Used for Workflows especially. Personally I prefer editing the xml myself so my discovery will be pure XML Editing.

Folders; To be more organised you can use folders to keep our fragments (.mpx files).

With the above kickstart my Project will look sth like this;


Highlevel Steps

  1. Design Your MP (decide your class type, what datasources you will use etc)
  2. Create VSAE Project (we will be using the Core One – Schema 1.0)
  3. Add Folders as necessary (my preference here is to add folder containing class declarations and a folder for discoveries)
  4. Add MP Fragments using the Templates (one for class one for discovery) and Edit the XML
  5. Check for errors , correct them.
  6. Generate the MP
  7. import into Management Group

Design Your MP

From the simplest to the most complex mps the author needs the design. In our case we will need a custom class based on the Windows.Computer Class and the datasource module we will use is Microsoft.Windows.RegistryDiscoveryProvider (http://msdn.microsoft.com/en-us/library/ff400189.aspx) because this provider lets multiple keys discovered at the same time for the class. The Provider that Operations Manager Console uses the Microsoft.Windows.RegistryDiscoverySingleProvider http://msdn.microsoft.com/en-us/library/ff400197.aspx which is limited by one key and is the reason for this post : ) )

Create VSAE Project

Easiest step. Just create an MP Project choosing the core on.


Add Folders

Create two folders name what ever you like, mine were “Class” and “Discovery” (see Folders section above).

Add MP Fragments and Edit the XML

First we need our class to be declared and defined to do so add a “new item” under the “Class” folder and select the basic xml template for “Class”


And then fill the XML skelaton as follows (added comments that might help in xml). Save close and rename this fragment as “computer class.mpx”

<ManagementPackFragment SchemaVersion="1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">   <TypeDefinitions>     <EntityTypes>       <ClassTypes>         <!-- First we have the declare our class which will be based on Windows.Computer              since we need its properties and relationships -->         <ClassType ID="CONTOSO.CustomComputerDiscovery.Computer" Base="Windows!Microsoft.Windows.Computer"                    Accessibility="Public" Abstract="false" Hosted="false" Singleton="false">          <!-- We  declared our Class above (the mpelement),          now we need to declare the subelements (the properties).-->           <Property ID="Owner" Key="false" Type="string" />           <Property ID="Environment" Key="false" Type="string" />           <Property ID="ServiceName" Key="false" Type="string" />         </ClassType>       </ClassTypes>     </EntityTypes>   </TypeDefinitions>   <LanguagePacks>     <LanguagePack ID="ENU" IsDefault="true">       <DisplayStrings>         <!-- IN this Section we are providing the actual Display Strings to be shown in Operations Console         for our main (class) and sub elements (properties) -->

        <DisplayString ElementID="CONTOSO.CustomComputerDiscovery.Computer">           <Name>CONTOSO Computer</Name>           <Description>Custom Computer Class for ING</Description>         </DisplayString>         <DisplayString ElementID="CONTOSO.CustomComputerDiscovery.Computer" SubElementID="Owner">           <Name>CONTOSO Computer Owner</Name>           <Description>TH Owner</Description>         </DisplayString>         <DisplayString ElementID="CONTOSO.CustomComputerDiscovery.Computer" SubElementID="Environment">           <Name>CONTOSO Computer Environment</Name>           <Description>Test, Prod or Development</Description>         </DisplayString>         <DisplayString ElementID="CONTOSO.CustomComputerDiscovery.Computer" SubElementID="ServiceName">           <Name>CONTOSO Computer Service</Name>           <Description>Service that owns CONTOSO Computer</Description>         </DisplayString>       </DisplayStrings>     </LanguagePack>   </LanguagePacks> </ManagementPackFragment>

Now we need the Discovery to be created , I wont be using the Advanced template as mentioned earlier since this is a very basic discovery I will edit the XML from scratch refering the providers MSDN Sample. To do so please add a “new item” under the “Discovery” folder naming “Computer Discovery.Mpx” and by selecting the “Empty Management Pack Fragment Template”.


Paste the below fragment (I added comments that might help)

<ManagementPackFragment SchemaVersion="1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">   <Monitoring>   <Discoveries>   <Discovery ID="CONTOSO.CustomComputerDiscovery.ComputerDiscovery" Comment="Discover Extended Properties using Registry" Enabled="true" Target="Windows!Microsoft.Windows.Computer" ConfirmDelivery="false" Remotable="true" Priority="Normal">

    <!-- IN previous Fragment (computer class.mpx we declared our class now are are discovering the instances using the     Microsoft.Windows.RegistryDiscoveryProvider the reason behind this provider is it lets multiple keys to be discovered at once.     -->     <Category>Discovery</Category>     <DiscoveryTypes>     <DiscoveryClass TypeID="CONTOSO.CustomComputerDiscovery.Computer">         <Property TypeID="CONTOSO.CustomComputerDiscovery.Computer" PropertyID="Owner" />         <Property TypeID="CONTOSO.CustomComputerDiscovery.Computer" PropertyID="Environment" />         <Property TypeID="CONTOSO.CustomComputerDiscovery.Computer" PropertyID="ServiceName" />      </DiscoveryClass>     </DiscoveryTypes>

   <DataSource ID="ComputerDiscoveryDS" TypeID="Windows!Microsoft.Windows.RegistryDiscoveryProvider">       <ComputerName>$Target/Property[Type="Windows!Microsoft.Windows.Computer"]/NetworkName$</ComputerName>         <RegistryAttributeDefinitions>         <RegistryAttributeDefinition>           <AttributeName>Owner</AttributeName>           <Path>SOFTWARE\CONTOSO\ComputerProperties\Owner</Path>           <PathType>1</PathType>           <AttributeType>1</AttributeType>         </RegistryAttributeDefinition>         <RegistryAttributeDefinition>             <AttributeName>Environment</AttributeName>             <Path>SOFTWARE\CONTOSO\ComputerProperties\Environment</Path>             <PathType>1</PathType>             <AttributeType>1</AttributeType>         </RegistryAttributeDefinition>         <RegistryAttributeDefinition>         <AttributeName>ServiceName</AttributeName>         <Path>SOFTWARE\CONTOSO\ComputerProperties\ServiceName</Path>         <PathType>1</PathType>         <AttributeType>1</AttributeType>       </RegistryAttributeDefinition>       </RegistryAttributeDefinitions>       <Frequency>86400</Frequency>       <ClassId>$MPElement[Name="CONTOSO.CustomComputerDiscovery.Computer"]$</ClassId>       <InstanceSettings>         <Settings>           <Setting>             <Name>$MPElement[Name="Windows!Microsoft.Windows.Computer"]/PrincipalName$</Name>             <Value>$Target/Property[Type="Windows!Microsoft.Windows.Computer"]/PrincipalName$</Value>           </Setting>           <Setting>             <Name>$MPElement[Name="CONTOSO.CustomComputerDiscovery.Computer"]/Owner$</Name>             <Value>$Data/Values/Owner$</Value>           </Setting>           <Setting>             <Name>$MPElement[Name="CONTOSO.CustomComputerDiscovery.Computer"]/Environment$</Name>             <Value>$Data/Values/Environment$</Value>           </Setting>           <Setting>             <Name>$MPElement[Name="CONTOSO.CustomComputerDiscovery.Computer"]/ServiceName$</Name>             <Value>$Data/Values/ServiceName$</Value>           </Setting>         </Settings>       </InstanceSettings>     </DataSource>   </Discovery>   </Discoveries>   </Monitoring>

  <LanguagePacks>     <LanguagePack ID="ENU" IsDefault="true">       <DisplayStrings>

        <!-- This is the string users of the Operations Console and Web Console will see.              Descriptions are also helpful when the user is doing a search in the Console. -->

        <DisplayString ElementID="CONTOSO.CustomComputerDiscovery.ComputerDiscovery" SubElementID="ComputerDiscoveryDS">           <Name>CONTOSO Computer Discovery DataSource</Name>           <Description>Registry Discovery Data Source based on Microsoft.Windows.RegistryDiscoveryProvider</Description>         </DisplayString>         <DisplayString ElementID="CONTOSO.CustomComputerDiscovery.ComputerDiscovery">           <Name>CONTOSO Computer Discovery</Name>           <Description>Registry Discovery based on Microsoft.Windows.RegistryDiscoveryProvider</Description>         </DisplayString>       </DisplayStrings>     </LanguagePack>   </LanguagePacks> </ManagementPackFragment>








Check for Errros and Correct Them

While building the solution VSAE will let you know if there are any issues like syntax errors, logical issues etc.

Generate the MP

Press F6 or click Build\Build Solution in the menu bar. You will notice the MP XML output in the Bin\Debug in your Project Folder.

Import the MP

VSAE has the capability of importing to the MG during build but I do this old school way by importing through Operations Manager console.

Once the Discovery Runs for the comptuers those have the registry keys deployed you will see the properties populated. I wont be going through create a dynamic group in this post but just to refer again you can check with the Kevins post refered and use the groups in creating views, setting overrides or notifications.


I hope you enjoyed this post and helps as a kick start to VSA MP Authoring.


  1. Kevins “Creating Custom Dynamic Computer  Group” Post - http://blogs.technet.com/b/kevinholman/archive/2009/06/10/creating-custom-dynamic-computer-groups-based-on-registry-keys-on-agents.aspx
  2. Microsoft.Windows.RegistryDiscoverySingleProvider - http://msdn.microsoft.com/en-us/library/ff400197.aspx (the provider scom console uses to create attributes)
  3. Microsoft.Windows.RegistryDiscoveryProvider - http://msdn.microsoft.com/en-us/library/ff400189.aspx (the provider I used to be able to use multiple keys as properties)
  4. Technet Wiki for using VSAE - http://social.technet.microsoft.com/wiki/contents/articles/5236.visual-studio-authoring-extensions-for-system-center-2012-operations-manager-en-us.aspx