Developing a WMI Provider

Started by thiruvasagamani, May 02, 2009, 05:42 PM

Previous topic - Next topic

thiruvasagamani


Developing a WMI Provider


A provider is a Component Object Model (COM) object that acts as an intermediary between WMI and a managed object. For example, when an application or script requests disk data using the WMI Win32_LogicalDisk class, the data is obtained dynamically through the preinstalled Win32 provider.

If you want to supply data through WMI to other applications, you can create an unmanaged code provider by writing a COM server or through the WMI ATL wizards in Visual Studio. You can write a managed code provider by using WMI in the .NET Framework. The topics in this section describe the process of writing an unmanaged COM provider.

Note  To ensure that all of your WMI class definitions for managed objects are restored to the WMI repository if WMI has a failure and restarts, use the #pragma autorecover preprocessor instruction in your Managed Object Format (MOF) file.

A provider consists of classes defined in the Managed Object Format (MOF) schema and a DLL file which carries out the functions of the provider. For example, the MOF that defines the classes of the Win32 provider is Cimwin32.mof and the DLL is Cimwin32.dll, both are found in %windir%\System32\Wbem.

The MOF schema for the provider may contain several provider types. For example, the Event Log Provider has instance, method, and event provider types in one MOF file named Ntevt.mof. It is recommended that all of the classes and registration schema for related providers be assembled in one file, rather than creating one file per class.

In addition to using preinstalled providers, you can create your own provider to supply information about a hardware device or the operations of software.

Source : MSDN
Thiruvasakamani Karnan