More than just a browser, WMIX packs more bang than fluff.
- By Chris Brooke
In past months and years I have written quite a bit about Windows Management Instrumentation (WMI) scripting in these pages, with good reason. I would go so far as to say that WMI offers the most power of any single component of Windows scripting—and quite a lot more than many
combined. Yet, we have only scratched the surface of WMI's capabilities, due in large part to the sheer size and
complexity of the WMI object model. Oh sure, the WMI SDK comes with a nice Web-based object browser to help, but you invariably end up wading through pages upon pages of properties as you try to gain some overall
perspective and really grasp WMI.
Well, your pursuit of knowledge
has just gotten easier, thanks to a new,
$69 utility called WMIX from PJ
Technologies. WMIX stands for WMI eXplorer, and it's really much more than just a "browsing" tool. But let's start there and see what makes it a
better tool for digging into WMI than the standard WMI Object Browser.
(By the way, I have no affiliation
whatsoever with PJ Technologies.)
First, while both allow you to view WMI by namespace—including CIMV2, DEFAULT, and so on, WMIX's Namespace and Class view is more flexible because you can change namespaces on the fly. WMIX also has a Browser View that supports browsing based on logical components, such as BIOS, computer system, processes,
network connection and more.
This hierarchical browsing model allows you to drill down into fundamental parts of each component,
providing enormous detail in a logical manner (see Figure 1).
|Figure 1. This WMIX view shows the Physical Memory of Mr. Script’s notebook computer, with Object Properties displayed in an additional window.
The Query View
The WMIX Query View gives you the capability to run standard WMI Query Language (WQL) queries directly from the user interface. So if, for instance, I wanted to use the query view to get the physical memory information I retrieved in Figure 1, I could simply execute this query: SELECT * FROM Win32_PhysicalMemory
Each instance that's returned is listed in the Results window. You'll find the query window is invaluable when you know where to look for something and you don't want to go "click crazy" drilling down via the browser view.
Another feature that sets WMIX apart from the WMI Object Browser is its ability to easily export information into a nicely formatted HTML file. This comes in handy when performing
system hardware inventories, listing installed software and other analytical activities. It comes pre-configured with standard reports, and allows you to
create custom reports, as well. If I had to nitpick, I'd wish for the ability to export the reports into XML—or even comma-delimited format—so that I could import the data into … well,
anything, and generate rich reports.
Suffice to say, looking through the WMIX lens gave me a whole new appreciation for WMI (and some cool ideas for future scripts, too). But, this is a scripting column so let's look at some of the ways that WMIX can help us write better WMI scripts.
WMIX seems to be designed primarily as a tool for administrators and managers, providing a nice graphical view of information from any computer in their organization. As scripters, we have our own ways of getting at this data, including the Microsoft Scriptomatic tool, which helps us write WMI scripts.
But a glaring limitation of
Scriptomatic is that the scripts it
generates only list the properties of a particular class. Many of these classes have methods that are quite powerful—if you know how to invoke them. WMI's object browser isn't much help here because it's sometimes very difficult to find the object that corresponds to the class name listed in Scriptomatic. And even if you do find the correct class and its methods, you almost have to guess at how to execute it.
WMIX's Browser View solves this problem because its listing corresponds almost letter-perfect to Scriptomatic's class listing. If Scriptomatic creates
a script to list the properties of Win32_BIOS, WMIX's Browser
View has this listed under "BIOS." Win32_Processes is listed in WMIX
as Processes, Win32_Service as
Services and so on. What's more, once you've found the desired method, WMIX really simplifies the process of working with it.
As an example of this, let's look at a WMI class that has lots of methods: The Registry. While Scriptomatic provides a wealth of information about the Registry, WMIX shows us how to make changes to the Registry. It lists each available method, along with the arguments required to execute it, and tells you what the method does and what type of data it returns. It even has an "Execute" button that runs the method for you, so you can be sure you're putting the right method call into your script. How cool is that?
A Better Mouse Trap
It's rare that I discuss tools in these pages, other than Microsoft-provided tools like the Scriptomatic. That's because most tools that cater to scripters, at least the ones I've seen, are more fluff than bang. We look at them, rub our chins and say, "Gee whiz." But in the end, we go back to The Way We've Always Done Things. WMIX is sending a nice, big bang your way. Cover your ears.
More Information"Notify with WMI" (Windows Insider, April 2005)
Find out how to use Windows Management Instrumentation (WMI) for system notifications without having to write scripts.
For more information on WMIX, visit PJ Technologies at www.pjtec.com/WMIX
Chris Brooke, MCSE, is a contributing editor for Redmond magazine and director of enterprise technology for ComponentSource. He specializes in development, integration services and network/Internet administration. Send questions or your favorite scripts to [email protected].