Using WMI Explorer: Create and run a query

You can run the WMI Explorer search and query features in Windows PowerShell. This feature helps you to automate your WMI queries and to learn the equivalent Windows PowerShell commands.

In this section:

Query and Query This

The simplest way to create and run a query for any WMI class on the currently connected computer, is to select a class and click the Query button, or right-click and then click Query this.

To query all properties of a WMI class:

  1. Select a WMI class. You can use the Namespace and Class windows to navigate to the class, or use the Search and Find features to find the class.

  2. On the ribbon, in the Query group, click Query.



    -or-

    Right-click the class name and then click Query this.

To query selected properties of a WMI class:

  1. Select a WMI class. You can use the Namespace and Class windows to navigate to the class, or use the Search and Find features to find the class.
  2. In the Property/Method pane, select properties. To select multiple properties, use Ctrl+Click and Shift+Click.
  3. On the ribbon, in the Query group, click Query (Ctrl+Q).



    -or-

    Right-click any highlighted item (a class name or a property name) and then click Query This.

Run a PowerShell Query

You can run queries in the Windows PowerShell console in WMI Explorer. For details, see section 4, Using WMI Explorer: Run in PowerShell in this manual.

When you run a query in the PowerShell console, you can view and edit the PowerShell command that WMI Explorer generates, and pipe the command to other cmdlets.

TIP: To get the PowerShell command that WMI Explorer ran, in the Query section of the menu, click the arrow key beside the PowerShell icon, and then click Copy PowerShell Code.

  1. In the Namespace and Class panes, select a class (or search for a class). To query particular properties of the class, in the Property/Method pane, select the properties.
  2. In the Query section of the menu, click PowerShell (Ctrl+P).

  3. You can view and copy the output in the Windows PowerShell console and run follow-up commands. To recall the command that WMI Explorer ran, click the up arrow.

Run a Custom Query

Most WMI queries are relatively simple, but occasionally, you want to create a more complex query. You can do it in WMI Explorer.

To create a custom query, start with a basic query.

  1. Select a WMI class. You can use the Namespace and Class windows to navigate to the class, or use the Search and Find features to find the class.
  2. [Optional] In the Property/Method pane, select properties. To select multiple properties, use Ctrl+Click and Shift+Click.
  3. On the ribbon, in the Query group, click the arrow under the Query button, and then select Custom Query.

    WMI Explorer displays the current query in WMI Query Language (WQL). For more information about WQL, see about_WQL.
  4. In the Custom Query window, edit the original WQL query to include the custom options, then click OK.

Examine the Results

When you run a query, WMI Explorer automatically displays the results in table format in the Query Results tab of the Output window.

To view the same query results in list format, on the ribbon, in the Query group, click Property List.

And, to examine the results in Windows PowerShell, on the ribbon, in the Query group, click PowerShell.

Need more?

This manual guides you through the features of WMI Explorer. If you have questions that aren't answered here, search the SAPIEN Blog and the WMI Explorer forum (for licensed users) or the Trial Software Questions forum (trial users). If you can't find what you need, post a question on either forum. We'll get back to you quickly.