本文件已封存並已停止維護。

How to Unbundle a Bundled Management Pack

更新日期: 2010年12月

A bundled management pack file (.mpb) includes several management pack (.mp) files. Additionally, it might include references to resources such as an image or a form assembly. To customize an .mpb file, you must access and customize the individual files in the bundle.

In this version of the Authoring Tool, you cannot directly open an .mpb file to access its individual files. Instead, you must manually unbundle the .mpb file and store all the .mp, .xml, and other resource files in a single folder that is accessible to the Authoring Tool. Then, you can open and customize the individual files in Authoring Tool in the same manner that you customize other management packs. After you complete the customizations, you need to re-bundle the files and generate a new .mpb management pack file.

You can extract most of the resource files from an .mpb file by using a Windows PowerShell script. The following procedures provide Windows PowerShell sample scripts that extract files from an .mpb file. 如需 how to use the Service Manager SDK to create other scripts, see Service Manager SDK (http://go.microsoft.com/fwlink/?LinkID=198541) on MSDN, the Microsoft Developer Network.

You cannot extract sealed management packs from an .mpb file. Package owners must provide each file separately for a sealed management pack.

To extract the individual unsealed management packs from an .mpb file

  1. Add the Service Manager Windows PowerShell snap-in to a Windows PowerShell session. 如需詳細資訊,請參閱 開始使用 Windows PowerShell 適用的 Service Manager 指令程式.

  2. In the Windows PowerShell console, type the following commands:

    mkdir <mpdir>
    
    Get-SCSMManagementPack -FullName .\<filename>.mpb | Export-SCSMManagementPack -Directory <mpdir>
    
    • In the command, replace the <mpdir> placeholder with the folder in which the extracted management pack files will be stored.

    • Replace the <filename> placeholder with the name of the .mpb file.

You can now navigate to the <mpdir> folder in the current working folder to view and to access the management pack files that you extracted.

To extract resource files from an .mpb file

  1. In a Windows PowerShell window, type the following commands:

    $SM2010DirKey = Get-ItemProperty "hklm:\SOFTWARE\Microsoft\System Center\2010\Common\Setup"
    $SM2010Dir = $SM2010DirKey.InstallDirectory 
    [reflection.assembly]::loadfrom($SM2010Dir + "\SDK Binaries\Microsoft.EnterpriseManagement.Packaging.dll")
    [reflection.assembly]::LoadWithPartialName("Microsoft.EnterpriseManagement.Core") | out-null
    $emg = new-object Microsoft.EnterpriseManagement.EnterpriseManagementGroup localhost
    $mpbReader = [Microsoft.EnterpriseManagement.Packaging.ManagementPackBundleFactory]::CreateBundleReader()
    $mpb = $mpbReader.Read("$PWD\Administration.mpb", $emg)
    

From the $mpb object, you can now access the $mpb.ManagementPacks; these are the management packs in the .mpb bundle. And, you can access the $mpb.GetStreams(ManagementPack),which gets the resources associated with a management pack in that bundle. These resources will be in the form of binary streams that you can write to files.

顯示: