WMI Query

Declaration

<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.

Practical Usage

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 Parameters

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)

  1. HOST="xxx.xxx.xxx.x"

  2. HOST="computerName"

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.

Description tab - A custom description can be provided on the Description tab to convey additional information or share special notes about a task step.

Error Causes tab - Specify how this step should behave upon the occurrence of an error. (Refer to Task Builder > Error Causes Tab for details.)

On Error tab - Specify what AWE should do if this step encounters an error as defined on the Error Causes tab. (Refer to Task Builder > On Error Tab for details.)

Examples

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 WHERE ThreadCount&gt;10</AMWMI>