PowerShell Tip: Unseal Multiple OpsMgr Management Pack Files WITHOUT a Live Management Group

Here’s a handy PowerShell script I put together a couple of years ago with some SDK magic I learned from MOW. The following PowerShell script will unseal multiple sealed management pack files (.mp files) in a directory structure and output the unsealed xml file to the directory of your choice. The script will actually parse the directory you point it to recursively, which means it will find .mp files in all the subdirectories and export to the directory you specify. Also, it will run from a standard PowerShell prompt…no OpsMgr Command Shell required. However, you do need to have the Operations console on the machine where you run the script.

Sample Script

SYNTAX: MptoXml.ps1

Example: .\MpToXml.ps1 C:\Software\MPs\sealed C:\Software\MPs\unsealed

More PowerShell Resources for System Center

We have a growing collection of PowerShell samples for System Center and general administration. You can find them in the Downloads section and many on this page – PowerShell Scripts for System Center (Master Collection)

Follow System Center Central (via Twitter and RSS)

Twitter_icon rss_big_default_300x300

0 thoughts on “PowerShell Tip: Unseal Multiple OpsMgr Management Pack Files WITHOUT a Live Management Group

  1. Andreas Zuckerhut

    Actually, that line shouldn’t be in the foreach:

    $assembly = [System.Reflection.Assembly]::LoadWithPartialName(“Microsoft.EnterpriseManagement.OperationsManager”)

    😉

    It actually should be:

    [System.Reflection.Assembly]::LoadWithPartialName(“Microsoft.EnterpriseManagement.OperationsManager”) | out-null

  2. Pete Zerger Post author

    Nice catch! I did a bit of cut-and-paste to Live Writer and flipped it around (although it works out of order too when I tried just now!) Also added the | out-null you suggested.

  3. Andreas Zuckerhut

    Sure it works, it’s just totally redundant.

    The $Assembly = do-something is because you don’t want to get any output I guess. I did that before I figured that I can do that with the out-null pipe. Before I figured that, I always did some $tmp = do-something

Leave a Reply

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