Latest posts by Mike Taylor (see all)
- How to create a PowerShell alias - Tue, Jul 29 2014
- System Center Updates Publisher - Create a SCUP catalog - Fri, May 23 2014
- System Center Updates Publisher - Third-party patch management - Wed, May 21 2014
WMI Explorer v1.10 is another lightweight (at 533KB), portable tool. To demonstrate its abilities I need to use WMI to find something I don’t already know and without using any books or the web. My example is to list the games I have installed and the path. The first step is to connect to a different namespace, as in the screenshot below.
WMI Explorer - Connecting to different namespaces
The interface lets you click on the open book icon to open a browse window, or you can just type directly into the namespace field if you already know what you want. You can also enter security credentials if you need to.
Clicking OK takes you to the main screen.
Browsing the "game" class with WMI Explorer
I want to see what properties exist for the “game” class, so selecting “game” in the top window queries the machine and gives you live results in the bottom left window. The right-hand window obviously lists the properties at your disposal. Note, the query field defaults to the favourite “select * from”. I did not type that string, WMI Explorer wrote it for me. Clicking "Execute" reveals the answer to my example, in figure 7.
The output from WMI Explorer
So, now you can the list of games in the name column and thus see my taste in games but that’s not quite the end of the story. You can now fine tune your WMI query and potentially speed it up. Note the time in the status bar at the bottom of figure 6, as 0.11 seconds.
The Win32_Volume class, Vista or later
Whilst this is just a basic example the issue of efficient queries is vital if you intend to run a script on machines remotely. Owing to the sheer wealth of data that WMI provides, the results can quickly get out of control. For example the trivial task of scanning machines for how much disk space they have left is easy using the win32_Volume (figure 8).
However it has 44 properties, so even running on 100 machines will scale up to 4400 properties. Rather than query everything with the crude use of “*” you can be more selective and choose only the properties you want. You probably know you achieve this using either the “where” clause or specifying explicit properties alone. Figure 9 shows just the name and path of the games on this machine. Note the time is now only 0.08 seconds.
A more efficient WMI query, perhaps
Using the two tools will make your job easier at the very least, but better still will help you to not upset the network team by dragging all the obscure WMI properties you don’t need over the LAN or worse over a low bandwidth and expensive leased line.