Log in  \/ 
x
x
x
Register  \/ 
x

08
March
2016

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.

screenshot1

The resulted script supports the following parameters:

  1. classname – required;
  2. computername – optional (for remote connection to the SCSM management server);
  3. 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;
  4. 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:

  1. Connects to the Service Manager and tries to find the class which name you set as a parameter;
  2. Searches all existing outriggers for the class;
  3. Collects all the class fields of the enumerator type (‘lists’) and sorts out all those that already have outriggers;
  4. Presents the a list of the fields without outriggers;
  5. Asks you to build an outrigger for the every class field from the list;
  6. Creates an XML file;
  7. Creates a sealed management pack.

It looks:

screenshot2

screenshot3

screenshot1

And the result:

screenshot4

 

You can download the script here.

 Update: I've updated the script to fix the error with duplicate references.

Categories: System Center 2012, SCUTILS BLOG

Marat Kuanyshev

Comments (5)

  • Chase Duncan

    Chase Duncan

    14 June 2016 at 00:15 |
    I created the sealed MP for my custom outriggeres using this tool, but when I tried to import it, I received the below errors. Any advice?

    The management pack import failed.
    Errors (6):
    Duplicate reference to the same management pack found. Alias Alias2 and Alias Alias1 refer to ManagementPack:[Name=CustomSAPIncident, KeyToken=0693cbc39b648001, Version=1.0.0.13].

    Duplicate reference to the same management pack found. Alias Alias3 and Alias Alias1 refer to ManagementPack:[Name=CustomSAPIncident, KeyToken=0693cbc39b648001, Version=1.0.0.13].

    Duplicate reference to the same management pack found. Alias Alias4 and Alias Alias1 refer to ManagementPack:[Name=CustomSAPIncident, KeyToken=0693cbc39b648001, Version=1.0.0.13].

    Duplicate reference to the same management pack found. Alias Alias5 and Alias Alias1 refer to ManagementPack:[Name=CustomSAPIncident, KeyToken=0693cbc39b648001, Version=1.0.0.13].

    Duplicate reference to the same management pack found. Alias Alias6 and Alias Alias1 refer to ManagementPack:[Name=CustomSAPIncident, KeyToken=0693cbc39b648001, Version=1.0.0.13].

    Duplicate reference to the same management pack found. Alias Alias7 and Alias Alias1 refer to ManagementPack:[Name=CustomSAPIncident, KeyToken=0693cbc39b648001, Version=1.0.0.13].

    reply

  • Marat Kuanyshev

    Marat Kuanyshev

    14 June 2016 at 10:01 |
    Hi Chase,
    You're right. I've fixed the issue with duplicate references. Please try to use the updated script.

    reply

    • Chase Duncan

      Chase Duncan

      14 June 2016 at 19:11 |
      I get the same results after re-downloading the script. Maybe I am not grabbing the latest one. Could you email it to me?

      reply

      • Marat Kuanyshev

        Marat Kuanyshev

        14 June 2016 at 19:31 |
        I've emailed but it's likely to be put in the spam folder or blocked cause it includes the PowerShell script.

        reply

        • Chase Duncan

          Chase Duncan

          14 June 2016 at 19:42 |
          Thanks Marat! I was able to import the MP after creating it with the new script.

          reply

Leave a comment

You are commenting as guest.

This is the default dialog which is useful for displaying information. The dialog window can be moved, resized and closed with the 'x' icon.