Execute WQL actions
Windows provides an infrastructure named Windows Management Instrumentation (WMI) to assist with system administration tasks. The WMI infrastructure includes a large number of classes that store information about the hardware and software environment of a Windows machine.
The information may be obtained from instances of the WMI classes using WQL, a query language that is similar to SQL in that it supports SELECT statements and WHERE clauses (among other statements). The general form of a simple WQL query is as follows:
SELECT <Attributes>
FROM <WMI Class>
[WHERE <Conditions>]
For example, the following query retrieves details about the operating system installed on a Windows machine, including the operating system name, its build number and Service Pack level:
SELECT *
FROM Win32_OperatingSystem
Individual attributes from the class may be specified instead of using a wildcard character, for example:
SELECT BuildNumber, Caption
FROM Win32_OperatingSystem
Attributes from the class may be used in a WHERE clause, for example:
SELECT *
FROM Win32_OperatingSystem
WHERE Caption = 'Microsoft Windows Server 2012 Standard'
Execute WQL actions allow WQL queries to be run against the LiveCompare server, or against a specified network-accessible machine. The results of the query are stored in a Table dataset.
| Action property | Description | 
|---|---|
| Hostname | A String parameter or dataset specifying the hostname of the machine against which the WQL query will run. If you don’t set this property, the query will be run against the LiveCompare server. | 
| Include System Properties | A Boolean parameter or dataset that determines whether system properties from the queried WMI classes will be included in the Result dataset. System properties have names prefixed with two underscores. The default value for this parameter is false. | 
| Namespace | A String parameter or dataset specifying the WMI namespace that contains the class used in the query. If you don’t set this property, \root\civm2 is used at the default value. | 
| Password | A String parameter or dataset containing the password for a user who has access to a remote machine. This property should be set if the Hostname property refers to a machine other than the LiveCompare server, and if the Username property is also specified. | 
| Query | A String Multiline parameter containing the WQL query to be executed. The results returned by the query’s SELECT statement are stored in the Result dataset. | 
| Result | A Table dataset that stores the results of the WQL query. | 
| String1 | A String parameter or dataset containing a value that may be substituted into the WQL query to be executed (optional). When used in a WQL query, ‘String1’ should be enclosed in single quotes. | 
| String2 | A second String parameter or dataset containing a value that may be substituted into the WQL query to be executed (optional). When used in a WQL query, ‘String2’ should be enclosed in single quotes. | 
| Username | A String parameter or dataset containing a Windows user account with access to a remote machine. The user account should be specified in the form domain name\account name. This property should be set if the Hostname property refers to a machine other than the LiveCompare server. | 
Example
                                                     
                                                
WMI classes
The following is a selection of classes from the \root\civm2 namespace.
| Class | Description | 
|---|---|
| Win32_ComputerSystem | Stores information about a computer system, including the hostname, system type and total amount of physical memory. | 
| Win32_OperatingSystem | Stores information about the currently active operating system. | 
| Win32_Service | Stores information about the services that are currently running on a system. | 
| Win32_Process | Stores information about the processes that are currently running on a system. | 
| Win32_Product | Stores information about a system’s installed software products. | 
| Win32_UserAccount | Stores information about the user accounts defined on a system. | 
A complete list of Win32 classes may be found here: http://msdn.microsoft.com/en-us/library/windows/desktop/aa394084(v=vs.85).aspx.
A description of the WMI Query Language (WQL) may be found here: http://msdn.microsoft.com/en-gb/library/windows/desktop/aa394606(v=vs.85).aspx.
Execute WQL actions support the use of the Define Action Parameters Wizard, which allows additional String properties to be created.