Exporting Management Packs

Customers have asked if you can see what is inside sealed management packs. The UI actually prevents this, but it is possible to do via the command shell. In both cases, you need to find the management pack you want to export through whatever method you prefer and then export it as below:

Command Shell Example:

Get-ManagementPack -Name "Microsoft.SystemCenter.2007" | Export-ManagementPack -Path "C:\"

SDK Example:

 using System;
using System.Collections.ObjectModel;
using Microsoft.EnterpriseManagement;
using Microsoft.EnterpriseManagement.Configuration;
using Microsoft.EnterpriseManagement.Configuration.IO;

namespace Jakub_WorkSamples
{
    partial class Program
    {
        static void ExportManagementPack()
        {
            // Connect to the local management group
            ManagementGroup mg = new ManagementGroup("localhost");

            // Get any management pack you want
            ManagementPack managementPack = 
                mg.GetManagementPack("Microsoft.SystemCenter.2007", "31bf3856ad364e35", new Version("6.0.5000.0"));
            
            // Provide the directory you want the file created in
            ManagementPackXmlWriter xmlWriter = new ManagementPackXmlWriter(@"C:\");
            xmlWriter.WriteManagementPack(managementPack);
        }
    }
}

Comments

  • Anonymous
    August 07, 2007
    Hi jakub, is is possible to export management pack that is located some other path???

  • Anonymous
    August 08, 2007
    Do you mean exporting to a different location? If so, the constructor for ManagementPackXmlWriter takes the path you want to export to.

  • Anonymous
    August 08, 2007
    hi jakub i want to export a pack that is not located in C:program files..... is it possible to specify the path of the management pack that needs to be exported??

  • Anonymous
    August 09, 2007
    If it is already on disk, why do you want to export it? The above sample talks about management packs imported into the management group already. If the MP is sealed, and on disk, and you want to export to xml, you can load it using new ManagementPack(<path to file>) and then export using the above code.

  • Anonymous
    August 13, 2007
    Jakub, I would like to programmatically export my unsealed MPs from our customer SCE installations on a schedule via Powershell, but need an assist of possible. I have created a profile script to load the SCE SDK libraries into a Powershell instance, but am unsure how to incorporate your SDK example above into Powershell friendly syntax. Can you provide an example? Here is a link to the SCE-friendly Powershell profile script we created. Any help is appreciated. http://systemcenterforum.org/wp-content/uploads/SCECmdShellEnv.pdf

  • Anonymous
    August 14, 2007
    I actually don't know a whole lot about the command shell. Have you looked at this blog? http://blogs.msdn.com/scshell/ If this doesn't help, send me an email directly and I will put you in touch with the developer for our command shell who will be able to help (he owns the scshell blog).

  • Anonymous
    August 17, 2007
    The comment has been removed

  • Anonymous
    August 17, 2007
    Can you not use the cmdlets? Get-ManagementPack -Name "Microsoft.SystemCenter.2007" | Export-ManagementPack -Path "C:" Please send me a direct mail using the contact form on the right with more specifics on what you are trying to do and I'll try to help.