WMI includes a query language called WQL. With this language, you can format a query string which defines the information to be returned. This is a very powerful tool as it enables you to fine tune a result set by configuring individual properties to be returned as well as by allowing you to specify conditions. A full definition of WQL is outside the scope of this user guide and we encourage you to review a book on this subject to explore its full potential. This user guide will only highlight its basic functions through a series of examples.
You can review more technical information about the WQL language by clicking on the WQL Reference Weblink in the Information Panel. This reference weblink points, by default, to the Microsoft® WMI Query Language page, however, you can configure this link to point to any web site in the WMIX Options window.
Using the Query WMI View you will be able to:
Execute any WQL query string and view the result set
Create sophisticated WMI Query strings using the WMI Query Wizard.
Generate a Script which executes the configured WMI Query
Add Query root objects in the Browser View
Using the Query WMI View you will NOT be able to:
Execute Object Tasks
Modify Object Properties
The WMI query view is very straightforward. It includes the query edit field, a Namespace selector and a Run Query button. Simply enter the query string in the edit field. Make sure that the selected namespace is the one owning the class subject of the query and click on the Run Query button (see Executing WMI Queries).
If you do not know the syntax of a WMI query or the available classes and properties, simply use the WMI Query Wizard to have WMIX generate the query for you.
Once you enter a query string in the edit field, the Add Query to Browser View button gets enabled. This button is located at the top right corner of the Query view. To set the currently entered query as a root object in the Browser view, click on this button. Once a query has been configured as a Browser view root object, it can be modified at any time from within the Browser view (see Modifying the list of Root Objects.)
WMIX can automatically generate a WMI Script which executes the currently configured WMI query. The generated script will execute the WMI query and reports on the attributes of the resulting instances.
To generate a WMI Query script:
Enter the desired WMI Query in the Query field
Click on the
button.
For more information about generating scripts, see: Script Generator
If you are already familiar with WQL, you can skip this section and go directly to the next section.
The Microsoft® WMI Query Language (WQL) allows for three types of queries: Data Queries, Schema Queries and Event Queries. Only Data Queries will be covered here. Data queries allow for the retrieval of instances for a particular class or association object. The basic format of a data query is as follows:
|
Syntax: |
SELECT* FROM<CLASSNAME> The SELECT statement indicates which property of the class you wish to query. Here we specify * which requests all properties of the class to be returned. |
|
Examples: |
SELECT* FROMWin32_DiskDrive SELECTBytesPerSector,InterfaceType FROMWin32_DiskDrive Note: Whether or not you specify * or a set of properties to return, the key properties of an object are always returned. |
You can add conditions to your data queries using the WHERE statement.
|
Syntax: |
SELECT* FROM<CLASSNAME> WHEREPROPERTY=<VALUE> |
|
Examples: |
SELECT* FROMWin32_Service WHEREStarted='False' Note: Since the Started property is of type BOOLEAN, its value could have been 0 instead of 'FALSE'. The following queries are all equivalent: SELECT * FROM Win32_Service WHERE Started=0 AND StartMode="Auto" Note: Since the StartMode property is of type STRING, the value must be within single or double quotes. SELECT* FROMWin32_LogicalDisk WHERECompressed<>TRUE AND FreeSpace<10485760 Note: The following boolean operators are available: =, != , <> SELECT* FROMWin32_LogicalDisk WHEREFileSystem="NTFS" |