InstrumentationManager Class


Provides methods that manage the lifetime and the model used for decoupled providers.

Note: the WMI .NET libraries are now considered in final state, and no further development, enhancements, or updates will be available for non-security related issues affecting these libraries. The MI APIs should be used for all new development.

Namespace:   System.Management.Instrumentation
Assembly:  System.Management.Instrumentation (in System.Management.Instrumentation.dll)


public static class InstrumentationManager


Makes an instance of a provider available within the WMI infrastructure.


Registers an assembly with the WMI infrastructure.


Registers a class with the WMI infrastructure.


Takes an instance of a currently available provider and makes it unavailable within the WMI infrastructure.


Unregisters an assembly currently registered with the WMI infrastructure.


Unregisters a class registered with the WMI infrastructure.

Decoupled providers are hosted by an application. Two methods can be used by the application to make instances of WMI classes available: publish/revoke or the callback method. The callback method uses the RegisterType and UnregisterType methods.

In the publish/revoke model, the WMI infrastructure provides default behavior for many of the methods you have to write yourself in the callback method. These include the enumeration and bind methods. In this model, the application creates instances and publishes them. The application is responsible for ensuring that the key properties of the classes are respected. The application is also responsible for deleting instances.

In the callback model, the WMI infrastructure expects the application to have methods that handle enumeration, binding and any other methods required to implement the functionality of the provider. It calls into the application for this functionality and fails if it does not exist or is not implemented properly. The application registers the type of its WMI classes with the infrastructure by calling RegisterType and indicates that it no longer wants the WMI classes exposed by calling UnregisterType.

The following example demonstrates how to use the publish/revoke model. Two instances of the router class are created and published. They are later revoked.

public class Sample_InstanceProvider
public int Main (string[] args) 
Router r_one = new Router ();
r_one.Name = "one";
Router r_two = new Router ();
r_two.Name = "two";
// ....
return 0;

In the next example, the callback method of registration is used to expose the RouterNew class.

public int MainNew(string[] args) 
    // ....
    return 0;

.NET Framework
Available since 3.5

Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top