Welcome to MSDN Blogs Sign in | Join | Help

Jakub@Work

Programming with System Center Service Manager and Operations Manager
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); } } }

Posted: Thursday, April 05, 2007 5:21 PM by JakubOleksy

Comments

Preethi R.S. said:

Hi jakub,

is is possible to export management pack that is located some other path???

# August 8, 2007 2:57 AM

JakubOleksy said:

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

# August 8, 2007 11:13 AM

Preethi R.S. said:

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??

# August 9, 2007 1:18 AM

JakubOleksy said:

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.

# August 9, 2007 9:55 AM

pzerger said:

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

# August 14, 2007 12:56 AM

JakubOleksy said:

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).

# August 14, 2007 11:02 AM

pzerger said:

Jakub,

I am familiar with Roger's blog, but have not found anything there that would help me. I would appreciate an assist on this one.

# August 17, 2007 9:30 AM

JakubOleksy said:

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.

# August 17, 2007 11:34 AM
Anonymous comments are disabled
Page view tracker