Creating a sealed management pack with SCSM outriggers using PowerShell
One of our popular free tool is SCUtils DWMPcreator that lets you generate sealed management packs for the Service Manager 2012 Data Warehouse within seconds. It can be used for classes and relationships and supports adding custom outriggers. However, you cannot create a management pack just for outriggers using DWMPcreator.
Usually, an outrigger management pack could be easily created manually but if you do it infrequently, it might be a time-consuming task. Yesterday I decided to build a simple PowerShell script that would automate this process. Surprisingly, the script happened to be quite long and not as short as expected.
The resulted script supports the following parameters:
- classname – required;
- computername – optional (for remote connection to the SCSM management server);
- keyfilename – optional (specify a key file’s name if you want to use your own key for sealing the output management pack. Copy your key file in the script folder). For lazy people, I’ve attached the default ‘contoso.snk’ key file used with DWMPcreator;
- companyname – optional (specify your company name, the default one is ‘company’).
If you run the script on the Service Manager management server, you have to define only your class name (not Id (Guid) or Display Name). For example, the class name of the default Incident class is System.WorkItem.Incident.
If your class name is ClassExtension_d81792e6_b56e_4b39_9b13_cc29e2ceff1a (the SCSM Authoring tool usually creates names like that), your PowerShell command might look like:
.\OutriggerBuilder.ps1 -classname ClassExtension_d81792e6_b56e_4b39_9b13_cc29e2ceff1a -computername SCSM2012R2 -keyfilename contoso.snk -companyname Contoso
Please run the script from the script’s location using the account with the sufficient security rights in the Service Manager.
What the script does:
- Connects to the Service Manager and tries to find the class which name you set as a parameter;
- Searches all existing outriggers for the class;
- Collects all the class fields of the enumerator type (‘lists’) and sorts out all those that already have outriggers;
- Presents the a list of the fields without outriggers;
- Asks you to build an outrigger for the every class field from the list;
- Creates an XML file;
- Creates a sealed management pack.
And the result:
You can download the script here.
Update: I've updated the script to fix the error with duplicate references.