PowerShell Script to Import MPBs into SCOM 2012 Beta

Update October 25th, 2011: There is a newer version of this script available.

With the release of SCOM 2012 Beta, the concept of a Management Pack Bundle (MPB) is finally available for Operations Manager.  A MPB
in the context of SCOM 2012 can be used as a mechanism for distributing binary files along with the MPs or for bundling UI components like a template
wizard.   MPBs are described in this SCSM blog posting (https://blogs.technet.com/b/servicemanager/archive/2009/09/04/introducing-management-pack-bundles.aspx); however, the short version is that a MPB is a Management Pack (MP) with binary file(s). This post will not focus on the work that needs to be done to build a MPB, rather it deals with how to write a PowerShell script to import the MPB.

The JEE Monitoring feature that my team developed for SCOM 2012 has several MPs.  There is a base library MP, library MPs for each application server, and leaf MPs that contains functionality for a specific version of a application server.  During the development process, it was much easier to script the importing of these Management Packs rather than manually using the Console interface.  The text file attached to this blog posting illustrates how to use PowerShell to import and remove MPs and MPBs.  Just rename the file extension to .ps1 and you should be good to go.

The heart of the script is that you need to import the MPB via Import-SCOMManagementPack.

For Example: 

  Import-SCOMManagementPack -Fullname "$localpathToMpsForImport\$mpb"
 

 

This differs slight from the old MP cmdlet Install-ManagementPack.

For Example:

 Install-ManagementPack -filepath "$localpathToMpsForImport\$mp"
  

 

Removing a MP or MPB is the same cmdlet: Uninstall-ManagementPack

For Example:

 Uninstall-ManagementPack -managementpack $MP
 

JeeMpHelper.txt