WMI - Query |
<AMWMI WQL="text" RESULTDATASET="text" NAMESPACE="text (options)" HOST="text" DOMAIN="text" USERNAME="text" PASSWORD="text (encrypted)" /> |
Description: Connects to a local or remote computer and performs a WMI Query Language (WQL) query to retrieve Windows Management Instrumentation (WMI) supported information and populates a dataset with results. This activity includes WMI Query Builder, a built-in graphical interface that allows you to easily browse WMI classes, objects and their properties and values.
IMPORTANT: This activity requires basic knowledge of WMI scripting language and familiarity with WMI mechanisms, such as class and property names. |
Normally used by Network Managers or System Administrators to monitor and control managed resources on a local or remote computer, thus, improving manageability of computers in a networked environment. For instance, a WQL Query task step can initially determine any issues and direct itself to perform proper activities to correct the problem before proceeding to other steps.
General
Property |
Type |
Required |
Default |
Markup |
Description |
WQL |
Text |
Yes |
(Empty) |
WQL= "SELECT HandleCount FROM Win32_Process WHERE name='iexplore.exe'" |
The WMI query to execute. Press the Query Builder button to open the WMI Query Builder, a graphical interface that allows exploration of the full set of namespaces, classes, properties and values available on a machine. Use this interface to navigate through the WMI set of objects and select the desired attributes. NOTE: By default, the WMI Query Builder displays the local computer's namespaces, classes, objects and properties. To display a remote computer's attributes, enable the Remote computer parameter in the Computer properties and enter the remote machine's required credentials (e.g.,computer name, username, domain and password). |
Namespace |
Text |
Yes |
root\CIMV2 |
NAMESPACE="root\CIMV2" |
The WMI namespace in which to execute the query. A WMI namespace contains a hierarchy of classes and associations which define either a machine's object or the relationship between two or more objects. Click the down arrow to select the desired namespace or enter it manually in the provided combo-box. This parameter's default value is root\CIMV2 (Common Information Model Version 2) which is the most commonly used namespace. NOTE: If a namespace is specified from the WMI Query Builder, the selected namespace overwrites any value currently entered in this parameter. |
Create and populate dataset |
Text |
Yes |
(Empty) |
RESULTDATASET="theWMIdata" |
The name of the dataset to create and populate with query results. NOTE: The value and amount of returned datasets will differ depending on the WMI query executed. |
Computer
Property |
Type |
Required |
Default |
Markup |
Description |
Local computer |
|
|
|
|
If enabled, specifies that queries will be performed on the local machine. This is a visual mode parameter only used during design time, therefore, contains no properties or markup. It is enabled by default. |
Remote computer |
|
|
|
|
If enabled, specifies that queries will be performed on a remote machine. When this parameter is enabled, the Local computer parameter is ignored. This is a visual mode parameter only used during design time, therefore, contains no properties or markup. It is disabled by default. |
Computer |
Text |
Yes if Remote computer parameter is enabled |
(Empty) |
|
The computer name or IP address of the remote (host) machine to query. This parameter is active only if the Remote computer parameter is enabled. |
Domain |
Text |
Yes if Remote computer parameter is enabled |
(Empty) |
DOMAIN="netauto" |
The domain name of the remote machine. On Win2000, WinXP and Server2003, if a domain name is specified, it is automatically appended to the username and separated with an @ symbol (e.g.,username@domain.com). This parameter is active only if the Remote computer parameter is enabled. |
Username |
Text |
Yes if Remote computer parameter is enabled |
(Empty) |
USERNAME="remoteUser" |
A valid username used to log onto the remote machine. This parameter is active only if the Remote computer parameter is enabled. |
Password |
Text |
Yes if Remote computer parameter is enabled |
(Empty) |
PASSWORD="encrypted" |
A valid password used to log onto the remote machine. This parameter is active only if the Remote computer parameter is enabled. |
NOTE: The sample AML code below can be copied and pasted directly into the Steps panel of the Task Builder. |
Sample 1: This query returns the number of handles used by all running instances of Internet Explorer on the local computer. Results are populated into DatasetName.HandleCount.
Send WQL "SELECT HandleCount
FROM Win32_Process
WHERE name='iexplore.exe' " to local machine and populate result.
<AMWMI RESULTDATASET="DatasetName" NAMESPACE="root\CIMV2">SELECT HandleCount FROM Win32_Process WHERE name='iexplore.exe' </AMWMI> |
Sample 2: This query returns the number of processes on the local computer which use more than 10 threads. Results are populated into DatasetName.ThreadCount.
Send WQL "SELECT ThreadCount
FROM Win32_Process
WHERE ThreadCount>10" to local machine and populate result.
<AMWMI RESULTDATASET="DatasetName" NAMESPACE="root\CIMV2">SELECT ThreadCount FROM Win32_Process WHERE ThreadCount>10</AMWMI> |