次の方法で共有


How to Uninstall a Management Pack

Applies To: System Center 2012 - Service Manager

[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

You can uninstall a management pack or management pack bundle with the basic procedures described here.

When you uninstall management packs, any external files such as form binaries and workflow binaries are not uninstalled. You must manually remove these components.

If other management packs are referencing the management pack you want to uninstall, the uninstall will fail. To identify which management packs may be blocking the uninstall, use the GetDependentManagementPacks method from the ManagementPacks property on the management group object.

To uninstall a management pack

  1. Use an instance of the EnterpriseManagementGroup to call the UninstallManagementPack method. Pass in the identity of management pack you want to uninstall.

To load and uninstall a management pack bundle

  1. Create a new instance of the EnterpriseManagementGroup class to connect to a management server.

  2. Get an instance of the ManagementPackBundleReader class by calling the CreateBundleReader method.

  3. Call the Read method. Supply the file name of the bundle, and an instance of the EnterpriseManagementGroup class. This will return you an instance of the ManagementPackBundle class.

  4. Use your existing EnterpriseManagementGroup instance to call the UninstallBundle method. Pass in the bundle you want to uninstall.

Example

The following example demonstrates how to load and uninstall a management pack bundle.

EnterpriseManagementGroup mg = new EnterpriseManagementGroup("localhost");
ManagementPackBundle bundle;
ManagementPackBundleReader bundleReader = ManagementPackBundleFactory.CreateBundleReader();
string bundleFile = @".\RePackaging.Library.mpb";

bundle = bundleReader.Read(bundleFile, mg);
mg.ManagementPacks.UninstallBundle(bundle);

The following example demonstrates how to uninstall a management pack object after you have a reference to it.

managementGroup.ManagementPacks.UninstallManagementPack(managementPack);

Compiling the Code

Namespaces

Microsoft.EnterpriseManagement

Microsoft.EnterpriseManagement.Packaging

Microsoft.EnterpriseManagement.Configuration

Assemblies

Microsoft.EnterpriseManagement.Core

See Also

Tasks

How to Install a Management Pack
How to Install a Management Pack with Resources
How to Reference Existing Management Packs

Reference

EnterpriseManagementGroup
ManagementPackBundleReader
ManagementPackBundleFactory
ManagementPackBundle

Other Resources

Scenario: Managing Management Packs