Tuesday, November 27, 2012

[OpsMgr 2012] Exporting Sealed and Non Sealed Management Packs using powershell script



As per in OpsMgr 2007, exporting sealed MPs in XML format in Operations Manager 2012 is very easy. You just add to run the the following command in the Operations Manager Shell :


Get-SCManagementPack | Export-SCManagementPack -Path “D:\Temps\ExportSealedMP”


For the non-sealed MPs, here is a short script you should save in a ExportNonSealedMP.PS1 file (this one is working with OpsMgr 2007 and 2012):

  1. param ($MGTServerName)
  2. add-pssnapin “Microsoft.EnterpriseManagement.OperationsManager.Client”;
  3. set-location “OperationsManagerMonitoring::”;
  4. new-managementGroupConnection -ConnectionString:$MGTServerName;
  5. set-location $MGTServerName;
  6. $mps = get-managementpack | where-object {$_.Sealed -eq $false}
  7. foreach ($mp in $mps)
  8. {
  9. export-managementpack -managementpack $mp -path “D:\Temp\Backup”
  10. }
 Then you can execute the following command line :

 ExportNonSealedMP.PS1 -MGTServerName YourServerName

This posting is provided "AS IS" with no warranties.

No comments:

Post a Comment