Authoring Configuration Management Pack Xplat

SCOM 2012 – VSAE Extend Unix Class For Dynamic Grouping

Some time ago I wrote a post where I extended a Linux class for dynamic grouping using the Visual Studio Authoring Extensions (VSAE). Well, this was just for playing around and testing some stuff. Recently I had a requirement to build views according to Unix teams. There were different Unix / Linux distributions, all kind of server names and in addition I needed to group the servers according to patch classes, service level and team. So there is no way of using any of the standard attributes of the computer or more specific classes. What we need is a way to add additional information to the Unix computer class, in a similar way as extending the Windows computer class with attributes from registry values.

Because the Unix computers are managed by different teams than SCOM, I needed a way to let the SCOM team manage information of grouping the computers and building the views etc. according to defined parameters in the CMDB.

I decided to rebuild the MP I had started previously and bring it to a level which would fit the requirements.

The idea is to upload a configuration text file into the directory /etc/microsoft via SCOM task. The configuration file is located in a defined file share location and can be uniquely identified by its FQDN name e.g. This file should contain the data in one line separated by semicolon “;” like PatchClassA;SLA1;CompanyXZ;TeamC; …

  • PatchClass = When the system gets patched like group A,B,C,D…
  • SLA = What service level does this system belong to 1,2,3,4….
  • Company = To which company does this system belong to XY, ABC…
  • Team = Which team is responsible for it A,B,C,D…

Ok, let’s start…

In VSAE I created a new solution for SCOM 2012 with classes, 2 discoveries and one task…


We derive our Unix.Dynamic.Groups.Computer class from the Microsoft.Unix.Computer class, and add two additional attributes OperatingSystem and the Attribute (for holding the additional information)…


One discovery is for discovering the operating system and the other for the attribute…


For the computer discovery I uses the data source  Microsoft.Unix.WSMan.TimedEnumerate.Filtered.MatchesRegularExpression.DiscoveryData . This will allow you filter the discovery using regular expressions on the Caption property of the target operating system. The Caption property gives you in most cases the operating system, version and architecture. How do you figure out what this property looks like? Well you need to query the SCOM agent with the OMICLI tool. Check this post on TechNet Wiki for more details.

If you have the SCOM 2012 R2 agent deployed run the following command on the target system…

/opt/microsoft/scx/bin/tools/omicli wql root/scx “select Caption from SCX_OperatingSystem”


For the SCOM 2012 (SP1) agent check Daniele Muscetta’s post. He shows how you could query properties from the SCOM agent using PowerShell and WS-Man.

In my case I am not using any filter <FilterValue>.*</FilterValue> (.* = Matches any single character zero or more times) which means I am going to hit any Unix / Linux operating system. Then I will map the Caption string to $MPElement[Name=”Unix.Dynamic.Group.Computer”]/OperatingSystem$


The attribute discovery uses a custom data source  Microsoft.Unix.WSMan.TimedCommandExecution.DiscoveryData and I use the shell command cat /etc/microsoft/scom.conf to retrieve the string in the scom.conf file and map StdOut value to the $MPElement[Name=”Unix.Dynamic.Group.Computer”]/Attribute$ .


Up to this point we have the Unix computer class extended, discovered the file in the /etc/microsoft/scom.conf directory and attached the content to the extended class. Now we need a way to upload the configuration file to the target system. For that case there is a task which uses the Microsoft.Unix.SFTPTransfer.WriteAction write action module. This module uses the SFTP to upload the file. In the configuration the <SourceFile> part points to the configuration file on the file share in this case \\scom2012r2\temp and would be named like this . The <TargetFile> part points to the path on the target system.


If you run the task, the file will be created as scom.conf in the /etc/microsoft directory.

Of course you need to create the target directory first by running the following commands….


In my case the privileged user account for monitoring the Unix system is called monuser and needs the read / write permission in the /etc/microsoft directory. The first command creates the directory, the second command changes the owner to monuser on that specific directory and the last command sets the permission to 750 which means the owner is able to read, write and execute, the group can read and execute (but not write) the rest cannot do anything with the files in this directory.

So that you are familiar with all the details & configuration possibilities I will show you how it works.

After you imported the MP go to Discovered Inventory and scope to Unix Computer Class Extended. One or more objects will appear…


Prepare the configuration file on your file share…


and add some data…


Next, select the target system in the SCOM console and run the Upload Config File (UNIX Dynamic Grouping) task…


As you can see you have the option to override the parameters. After the task ran successfully…


…the data will be picked up during the next discovery cycle…


OK, but how are we going to group the computers? Well, this is going to be a bit trickier using regular expressions. Let’s say, I would like to provide a view for Team C with only their computers. Because of that I need to create a dynamic group for Team C and I know that the team definition is always at the fourth position in the file / attribute. If you remember our string looks like this PatchClassA;SLA1;CompanyXZ;TeamC;. In the SCOM console go to Authoring/Groups, start the group wizard and when you have to choose the dynamic group criteria, add the Unix Computer Class Extended and select the Extended Unix Attribute…


You need to add the following regular expression as filter criteria. This will parse the attribute and if it finds the string TeamC at the fourth position it will add the computer object to the group…


Of course depending on your situation you need to adjust this expression but I hope this gives you the idea and a good starting point.

If you configured everything properly and you check the group membership you will see the computer has been added…


I just would like to add few comments:

  • You need to adjust the discovery intervals they are set currently to 300 seconds which is too low. Use e.g. 14400 seconds which is 4 hours.
  • Use the MP in your lab first!
  • If you run the task it uses the management server action account to access the file share. Therefore make sure this account has read permission to the file share and configuration file.
  • For creating the configuration files you could use Orchestrator and some nifty queries to build the files out of your CMDB directly, so that you need to run the task only in a controlled way.
  • Seal the MP using your own *.snk file.

I hope this provides you with a good solution and if you have any thoughts or ideas, let me know.

You can download the VSAE project files from TechNet Gallery.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.