Export Sealed or Un-Sealed Management Packs

Use this powershell script to Export Management packs of sealed or unsealed  in Ops Mgr 2007 for use as a timed rule in OpsMgr or as a manual task. You can also explore the sealed packs fire up in authoring console to see how well or often not so well the Sealed MP’s are written.

$rootMS =’RMSFQDN’
$targetFilePath=’E:\OpsMgr\MPBackup\’

#Initializing the Ops Mgr 2007 Powershell provider
add-pssnapin “Microsoft.EnterpriseManagement.OperationsManager.Client” -ErrorVariable errSnapin ;
set-location “OperationsManagerMonitoring::” -ErrorVariable errSnapin ;
new-managementGroupConnection -ConnectionString:$rootMS -ErrorVariable errSnapin ;
set-location $rootMS -ErrorVariable errSnapin ;

#False=Unsealed & True=Sealed
$mps = get-managementpack | where-object {$_.Sealed -eq $False}
foreach($mp in $mps)
{export-managementpack -managementpack $mp -path $targetFilePath}

Additionally you may want to head over to System Center Central and download the Unsealed MP Backup MP which allows you to set schedules, days to keep previous MP versions and path to directory.

http://www.systemcentercentral.com/PackCatalog/PackCatalogDetails/tabid/145/IndexID/11522/Default.aspx

Advertisements
This entry was posted in Command Shell - Powershell Reference. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s