Windows Management Instrumentation (WMI) is mainly a programmer's tool that provides programmatic ways to manage a system or get information about the manageable objects in a system. Now, not everyone's a programmer, nor does everyone want to be. However, nearly every administrator is going to have someexposure to programming, even if it's just to use pre-generated code samples.
One utility for generating code that can be used to work with WMI objects is a free tool from Microsoft, called the WMI Code Creator. This is by far the most comprehensive tool I've found for this kind of work, and it's designed to make working with WMI namespaces as effortless as possible.
The program is a self-contained executable; no installation is needed. When you run it, it presents you with four tabs:
- Query for Data from a WMI Class;
- Execute a Method;
- Receive an Event; and
- Browse the Namespaces on this Computer.
In each tab there's a dropdown that presents a list of all available namespaces and classes for that namespace; there are also drop-downs or selectors for other entities available with each type of item.
For instance, the Method tab contains a list of methods, as well as parameters. If you're querying for data from a WMI class, you can select the properties, then search for any values available for that property. The Receive an Event tab even has a hotlink directly to the online MSDN library that lets you look up the documentation available for the selected event class.
Once you've selected all the details of the WMI class, the code generated to use that class appears in a right-hand pane. If you want to change the language of the code, select one from the Code Language menu; the program supports C#, VB.NET and classic VBScript. The resulting code can also be automatically opened in Notepad or sent directly to a command line to be executed. Finally, the WMI classes don't have to be pulled exclusively from the current computer; any computer that's accessible via RPC can be polled for WMI objects.
Serdar Yegulalp is editor of the Windows Power Users Newsletter. Check it out for the latest advice and musings on the world of Windows network administrators. He is also author of the book Windows Server Undocumented Solutions.
More information from SearchWinSystems.com
- Tip: Microsoft utility helps admins diagnose WMI services
- Topics: Windows Management Instrumentation
- RSS: Sign up for our RSS feed to receive expert advice every day.