COM API for WMI

You can use the WMI Component Object Model (COM) API to write management client applications or create a new WMI provider. The COM API reference provides information for advanced system administrators, as well as developers who are writing client and provider applications.

For more information about writing WMI enterprise management applications, see Creating a WMI Application Using C++. For more information about how to write a WMI provider, see Providing Data to WMI.

Note

WMI only supports C++ development using Microsoft Visual C++ version 6.0 and later development systems. However, you can also use other compilers such as those from Borland and Watcom.

 

Each of the different WMI objects inherit from an interface ultimately inherited from the IUnknown interface. COM dictates how object implementers, or interfaces, handle tasks such as memory management, parameter management, and multithreading. By conforming to COM, the COM API for WMI ensures that it supports the functionality provided by the interfaces of each WMI object.

WMI is accessed through the following WMI-specific COM interfaces.

Interface Description
IEnumWbemClassObject Enumerator that works with objects of type IWbemClassObject. It is similar to standard COM enumerators, such as IEnumVariant.
IMofCompiler Implemented by Mofd.dll, this interface provides a COM interface that is used by the MOF compiler and any other applications that compile MOF files.
IUnsecuredApartment Used to simplify the process of making asynchronous calls from a client process.
IWbemBackupRestore Backs up and restores the contents of the WMI repository.
IWbemCallResult Used for semisynchronous calls of the IWbemServices interface. When making such calls, the called IWbemServices method returns immediately, along with an IWbemCallResult object.
IWbemCausalityAnalysis Tracks child requests that are generated from a parent request.
IWbemClassObject Contains and manipulates both class definitions and class object instances. Developers need not implement this interface; WMI provides its implementation.
IWbemConfigureRefresher Used by client code to add or remove enumerators, objects, and nested refreshers into a refresher.
IWbemContext Optionally used to communicate additional context information to providers when submitting IWbemServices calls to Windows Management.
IWbemDecoupledBasicEventProvider Registers decoupled providers with WMI.
IWbemDecoupledRegistrar Associates decoupled providers with WMI. This interface allows a process-hosted provider to define the interoperability lifetime of the interface and coexist with other providers.
IWbemEventConsumerProvider Provides the primary interface for an event consumer provider. Through this interface and the FindConsumer method, an event consumer provider can indicate which event consumers should receive a given event.
IWbemEventProvider Used to initiate communication with an event provider.
IWbemEventProviderQuerySink Optionally implemented by event providers who want to know what kinds of event query filters are currently active to optimize performance.
IWbemEventProviderSecurity Optionally implemented by event providers who want to restrict consumer access to their event.
IWbemEventSink Initiates communication with an event provider using a restricted set of queries. This interface extends IWbemObjectSink, providing new methods dealing with security and performance.
IWbemHiPerfProvider Enables providers to supply refreshable objects and enumerators.
IWbemHiPerfEnum Used in refresher operations to provide rapid access to enumerations of instance objects.
IWbemLocator Obtains the initial namespace pointer to the IWbemServices interface for WMI on a specific host computer.
IWbemObjectAccess Provides access to the methods and properties of an object. An IWbemObjectAccess object is a container for an instance updated by a refresher.
IWbemObjectSink Used to receive both the results of IWbemServices and certain types of event notifications.
IWbemObjectTextSrc Used to translate IWbemClassObject instances to and from differing text formats.
IWbemPropertyProvider Supports retrieving and updating individual properties in an instance of a WMI class.
IWbemProviderIdentity Implemented by an event provider if the provider registers itself using more than one Name (multiple instances of __Win32Provider) with the same CLSID value. The class provides a mechanism for distinguishing which named provider should be used.
IWbemProviderInit Used to initialize providers.
IWbemProviderInitSink Implemented by WMI and called by providers to report initialization status.
IWbemQualifierSet Acts as a container for the entire set of named qualifiers for a single property or entire object (a class or instance).
IWbemQuery Provides an entry point through which a WMI Query Language (WQL) query can be parsed.
IWbemRefresher Provides an entry point through which refreshable objects such as enumerators or refresher objects, can be refreshed.
IWbemServices Used by clients and providers to access WMI services. The interface is implemented only by WMI and is the primary WMI interface.
IWbemStatusCodeText Extracts text string descriptions of error codes or the name of the subsystem where the error occurred.
IWbemUnboundObjectSink Implemented by all logical event consumers. It is a simple sink interface that accepts delivery of event objects.

 

Note

Many of the WMI COM functions return numeric error codes that are documented as named constants. These constants are defined in Wbemcli.h in the PSDK WMI\Include folder. For more information, see WMI Return Codes.

 

For more information about the following topics for COM programming, see Component Development:

  • Interfaces and object design.
  • Implementing IUnknown.
  • Memory management
  • Handling reference counting.

WMI Reference