What are the steps to update a sealed custom MP ?

I need to update a MP that our implementation partner developed a while ago. Can somebody give me some pointers on how to do it ? I simply want to add a custom property to the Incident class. We have a sealed Incident ClassTypes custom MP that I need to update.

Best Answer

  • Stephane_BouillonStephane_Bouillon Customer IT Monkey ✭
    Accepted Answer
    After searching hi and low, I couldn't find any issue with the MP, so what I did with the help of @john_doyle was edit the xml with a text editor, and then sealed the MP using PowerShell, this finally allowed me to import the MP

    $SMDIR    = (Get-ItemProperty 'hklm:/software/microsoft/System Center/2010/Service Manager/Setup').InstallDirectory
    Set-Location -Path $SMDIR
    If (!(Get-Module –Name “System.Center.Service.Manager”)) { Import-Module ".\Powershell\System.Center.Service.Manager.psd1" }
    cd "C:\Sources\Custom Management Packs"
    Protect-SCSMManagementPack -ManagementPackFile .\xml\Custom.Incident.ClassTypes.xml -CompanyName MyCompany -KeyFilePath .\Management\mpprivatekey.snk -Copyright 2018 -OutputDirectory .\sealed
    ([system.reflection.assembly]::loadfile("C:\Sources\Custom Management Packs\sealed\Custom.Incident.ClassTypes.mp")).FullName

Answers

  • Joe_BurrowsJoe_Burrows Cireson Devops Super IT Monkey ✭✭✭✭✭
    Hi Stephane 

    Checkout the steps below:

    This assumes you have already created the MP, sealed it, and imported it into SCSM 2012:

    1) Export the sealed MP from SCSM, you will now have the MP as an .xml file.

    2) Make your changes to the MP .xml file, if using the Authoring Tool the version should increment automatically but if editing the MP manually remember to increment the version number each time.

    3) Seal the MP .xml file with the same key file as you used before so that it is now an .mp file, you can do this within the Authoring Tool or via PowerShell.

    4) Import the sealed MP .mp file into SCSM

    That's it, I overwrite the MP that is already in SCSM, I don't delete them before importing the next version of it.

    https://social.technet.microsoft.com/Forums/systemcenter/en-US/09a02b00-c1b9-4d60-a52f-f168a9acabf7/how-do-i-unseal-a-management-pack?forum=systemcenterservicemanager

    Cheers
    Joe
  • Stephane_BouillonStephane_Bouillon Customer IT Monkey ✭
    Thanks for your explanation Joe, I updated the xml file and increased the version number. However, when I try to seal the xml file, nothing happens and the .mp file is not created. I use the following code:

    #Import modules
    Import-Module SMLets -Verbose
    Import-Module MPSCSM -Verbose

    #Change xml to the correct value
    $Xml = "C:\Sources\Multipharma Management Packs\Management\xml\Multipharma.Incident.ClassTypes.xml"
    $FastSealPath = "C:\Sources\Multipharma Management Packs\Management\FastSeal.exe"
    $SNK = "C:\Sources\Multipharma Management Packs\Management\mpprivatekey.snk"
    $Company = "Multipharma"
    $OutDirectory = "C:\Sources\Multipharma Management Packs\Management\sealed"
    Set-MPSCSMSealManagementPack -Xml $Xml -FastSealPath $FastSealPath -SNK $SNK -Company $Company -OutDirectory $OutDirectory -Verbose
    I just reused the PowerShell that was created by our implementation partner before, not 100% sure if it is correct. Could you give me the syntax on how to do it, in case there is an error ?

    Stephane
  • Stephane_BouillonStephane_Bouillon Customer IT Monkey ✭
    I tried to do the same using the authoring tool. So I exported the existing MP and opened it in the Authoring Tool. First thing that is odd, is that when I open the xml file, I get an error saying:

    Could not load management pack [ID=Multipharma.Enumeration.CustomLists, KeyToken=84239e5b1d59d9f8, Version=1.3.0.0]. The management pack was not found in the store.
    Next I get a prompt to open the referenced MP, so I point it to the directory where I keep a copy of the sealed mps and it seems to be satisfied with that.

    What I do then, is edit the EMM.ClassTypes.Incident.Extension.Customproperties and click the "Create property..." button, and give it a name "Actionscript". This results in yet another error

    Service Manager Authoring ToolThe management pack could not be verified due to this error: Verification failed with 1 errors:-------------------------------------------------------Error 1:Found error in 1|Multipharma.Incident.ClassTypes|1.0.0.0|Multipharma.ClassTypes.Category|| with message:The Target attribute value is not valid. Element Multipharma.ClassTypes.Category references a Target element that cannot be found.

    How can I move forward with this ?
  • Stephane_BouillonStephane_Bouillon Customer IT Monkey ✭
    I'm assuming the culprit is this element in the xml, but I don't know what's wrong with it:

    <Categories>
        <Category ID="Multipharma.ClassTypes.Category" Value="Console!Microsoft.EnterpriseManagement.ServiceManager.ManagementPack">
          <ManagementPackName>Multipharma.Incident.ClassTypes</ManagementPackName>
          <ManagementPackVersion>1.6.0.0</ManagementPackVersion>
          <ManagementPackPublicKeyToken>84239e5b1d59d9f8</ManagementPackPublicKeyToken>
        </Category>
      </Categories>

  • Ryan_Kennedy1Ryan_Kennedy1 Customer IT Monkey ✭
    Try deleting that line <ManagementPackPublicKeyToken>84239e5b1d59d9f8</ManagementPackPublicKeyToken> and attempting to seal the management pack again with the key originally used to seal the management pack. That should do it. What has to be done when using the authoring tool anyway.
  • Stephane_BouillonStephane_Bouillon Customer IT Monkey ✭
    I have a suspicion that my MP has a dependency on another sealed MP that was updated after my MP was imported. My MP references this MP as v 1.3.0.0 while it is loaded in the system with v 1.6.0.0. How can I retrieve the PublicKeyToken of the referenced MP ?
  • Stephane_BouillonStephane_Bouillon Customer IT Monkey ✭
    Accepted Answer
    After searching hi and low, I couldn't find any issue with the MP, so what I did with the help of @john_doyle was edit the xml with a text editor, and then sealed the MP using PowerShell, this finally allowed me to import the MP

    $SMDIR    = (Get-ItemProperty 'hklm:/software/microsoft/System Center/2010/Service Manager/Setup').InstallDirectory
    Set-Location -Path $SMDIR
    If (!(Get-Module –Name “System.Center.Service.Manager”)) { Import-Module ".\Powershell\System.Center.Service.Manager.psd1" }
    cd "C:\Sources\Custom Management Packs"
    Protect-SCSMManagementPack -ManagementPackFile .\xml\Custom.Incident.ClassTypes.xml -CompanyName MyCompany -KeyFilePath .\Management\mpprivatekey.snk -Copyright 2018 -OutputDirectory .\sealed
    ([system.reflection.assembly]::loadfile("C:\Sources\Custom Management Packs\sealed\Custom.Incident.ClassTypes.mp")).FullName

This discussion has been closed.