Troubleshooting WMI Provider Extensions

Use the following tips to help you troubleshoot your WMI.NET Provider Extensions providers.

Installation and Setup

Carefully following the steps described in one of the basic provider example topics, How To: Create a Basic Decoupled Provider or How to: Create a Basic In-Process WMI Provider will demonstrate how to properly compile, register and host a provider.

Still, these simple initial steps are the source of many errors when you are learning to work with the provider extension framework. Use the following checklist as a starting point when debugging.

Ensure that you:

  1. Run installutil against the program or library that implements the provider.
  2. Carefully check the output of installutil to confirm that it was successful in registering the provider. If it encounters problems, it will usually include useful error messages to help you fix them.
  3. Register in-process providers in the Global Assembly Cache (GAC). You must sign the libraries that implement your providers to do this.
  4. Run the program that hosts your decoupled providers. Although you will be able to see registration information in the WMI repository even when the host program is not running, the host must be running to access the underlying functionality.
  5. Ensure that your installer class is inheriting from DefaultManagementInstaller, not DefaultManagementProjectInstaller.

ManagementBind Parameter Names

The names of the parameters to the method that is marked with the ManagementBindAttribute must be exactly the same as the name of the key field or property they correspond to.

Event Log

The WMI Provider Extensions infrastructure logs messages in the Application log. These messages, which indicate WMI as their Source, often include useful debugging information. In addition, you can find useful information in messages logged in the Application log by the .NET Runtime.

MOF Output

One of the time saving features of WMI Provider Extensions is that the infrastructure handles the generation and registration of the MOF-based descriptions of your WMI classes. You simply include the following code in your project:

[System.ComponentModel.RunInstaller(true)]
public class TheInstaller : DefaultManagementInstaller
{ }

When you use installutil.exe to register your project, it performs the custom tasks required to register your WMI classes. Normally, it is very convenient to have this process take place automatically and transparently. However, when troubleshooting, you might want to examine the MOF that installutil.exe is generating for you. To do this, you use the custom /MOF switch that installutil.exe supports when run against a program or library that uses WMI Provider Extensions. Type installutil /mof=<outfile> <dll_or_exe> to generate a MOF file named outfile.

See Also

Reference

System.Management.Instrumentation

Other Resources

WMI Troubleshooting

Send comments about this topic to Microsoft.

Copyright © 2007 by Microsoft Corporation. All rights reserved.