Goverlan
GUIDE MENU

INTRODUCTION TO THE QUERY WMI VIEW

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

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.

Adding WMI Query to the Browser View

Once you enter a query string in the edit field, the Add Query to Browser Viewbutton 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.)

Generating a Script of a WMI Query

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:

  1. Enter the desired WMI Query in the Query field

  2. Click on the  button.

 

For more information about generating scripts, see: Script Generator

Introduction to WQL

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 
where is the WMI name of the class object (see Namespace & Class view.)

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.
The FROM statement indicates which class to return the properties from.
 

Examples:

SELECT * FROM Win32_DiskDrive
Returns the full set of properties for all instances of the Win32_DiskDrive class.

SELECT BytesPerSector,InterfaceType FROM Win32_DiskDrive
Returns the bytes per sector and interface type properties for all instances of the Win32_DiskDrive class.

Note: Whether or not you specify * or a set of properties to return, the key properties of an object are always returned.

Adding Conditions

You can add conditions to your data queries using the WHERE statement.

Syntax:

SELECT * FROM  WHERE PROPERTY=
 

Examples:

SELECT * FROM Win32_Service WHERE Started='False'
Returns all services which are not started.

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='False'
SELECT * FROM Win32_Service WHERE Started=FALSE
SELECT * FROM Win32_Service WHERE Started=0
SELECT * FROM Win32_Service WHERE Started='0'

SELECT * FROM Win32_Service WHERE Started=0 AND  StartMode="Auto"
Returns all services which are not started and have the start mode configured to Automatic.

Note: Since the StartMode property is of type STRING, the value must be within single or double quotes.

SELECT * FROM Win32_LogicalDisk WHERE Compressed<>TRUE AND FreeSpace<10485760
Returns all disk drives which are not compressed and where the amount of free disk space is less than 10 Megabytes (10485760 bytes).

Note: The following boolean operators are available:  =, != , <>

SELECT * FROM Win32_LogicalDisk WHERE FileSystem="NTFS"
Returns all disk drives which are of type NTFS.