Export (0) Print
Expand All

InstrumentationManager Class

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

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

public static class InstrumentationManager

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;


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

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5

Community Additions

© 2015 Microsoft