Writing WMI provider in a day

Writing WMI provider in native code has steep learning curve. It involves writing MOF files and implementing methods from IWbemServices and IWbemProviderInit interfaces. Sometimes it becomes difficult and time consuming to debug issues in the WMI provider.

WMI.Net Provider Extension 2.0 was first introduced in Visual studio 2008 and is part of .Net Framework 3.5. It is based on the attribution model where MOF files are generated automatically and developers doesn’t have to implement any of the methods from the IWbemProviderInit or IWbemServices interfaces. Attributes can be added at the assembly, class, properties or method levels to specify what part of the managed application exposes WMI functionality. WMI.Net Provider Extension 2.0 generates MOF file and register it automatically based on the information provided in the attributes.

WMI.Net Provider Extensions 2.0 can be used to write both coupled providers and decoupled providers. There is a very good article on writing coupled providers here .

Writing WMI Providers in WMI.Net Provider extension 2.0 is fairly easy to write and debug. To give an idea I was able to write my own Win32_Process class with extended functionality in less than a day.