WMI Explorer: Running Queries
- Written by Alexander Riedel
- Last Updated: 19 April 2016
- Created: 03 September 2013
- Hits: 3249
WMI has a large amount of namespaces, classes and properties. While the WMI Explorer allows you to browse, search and filter all these items, it also enables you to query the underlying data for all of this.
What you see above here is a standard query for the selected class. It is the same as running a “select * from Win32_Service” in this case. You can also limit the number of columns or properties by only selecting the items you need.
In this case we selected the ‘Caption’ and ‘State’ properties only to get a list of all services and their respective states. If you use the “Property list” button on the ribbon you get a style of output that you may be more familiar with if you use Windows PowerShell.
You can also run the query in PowerShell to see what the output there would look like.
This will launch a new instance of PowerShell and submit the appropriate command to query the classes or properties you selected. While it is unfortunate that PowerShell does not include anything submitted on the command line in the command history, you can still get the command we use to do this:
Just click on the down arrow and select “Copy PowerShell Code” and you get the one-liner we use to get that output.
If you are only interested in the data from a query, but not really in how to do this with PowerShell, you can just export your data in a number of different formats. Simply run the query inside WMI Explorer, either as a table or as a property list, and select one of the export commands.
We kept the resulting output files as generic as possible to make it easier for you to customize these files or use them as input for other processes. If there are any other query and export function you want to see, don’t be shy, let us know.