Share via


Microsoft.Windows.WmiProbe

Applies To: Operations Manager 2007 R2

The Microsoft.Windows.WmiProbe module is a probe action module type that is used to query Windows Management Instrumentation (WMI) for instance data and return the information as a System.PropertyBagData type.

Usage

Use this module when you want to query for WMI objects and return the data as one or more System.PropertyBagData elements within a workflow such as a rule or monitor.

Type Definition

<ProbeActionModuleType ID="Microsoft.Windows.WmiProbe" Accessibility="Public">
  <Configuration>
    <xsd:element name="NameSpace" type="xsd:string" />
    <xsd:element name="Query" type="xsd:string" />
  </Configuration>
  <ModuleImplementation>
    <Native>
      <ClassID>92A40C04-DE27-47E2-ADB3-CD960E6BD9E2</ClassID>
    </Native>
  </ModuleImplementation>
  <OutputType>System!System.PropertyBagData</OutputType>
  <InputType>System!System.BaseData</InputType>
</ProbeActionModuleType>

Parameters

The Microsoft.Windows.WmiProbe module supports the configuration parameters described in the following table.

Parameter Type Overrideable Description

Namespace

String

False

Required parameter. Specifies the WMI namespace within which the module is to run the query.

Query

String

False

Required parameter. Specifies the SELECT WMI query to run.

The Namespace parameter must be a valid WMI namespace that is present on the monitored computer, or the module raises an error in the Operations Manager event log.

The namespace should always specify the computer to connect to as part of the string. If a computer is not specified, the workflow reads from the local computer, which does not work for agentless monitoring scenarios. The computer name is most commonly passed to the module that is using the $Target notation.

The following code example shows a fully configured Namespace parameter in a workflow that is targeted at the Microsoft.Windows.Computer class type. This example retrieves data from the root\cimv2 WMI namespace.

<NameSpace>\\$Target/Property[Type="Windows!Microsoft.Windows.Computer"]/NetworkName$\ROOT\CIMV2</NameSpace> 

There is a two-minute time-out for connecting to the WMI Namespace.

The Query parameter must be a valid WMI query that can be executed against the specified WMI namespace, as shown in the following example:

<Query>select DeviceID from win32_logicaldisk</Query> 

It is possible to reference object properties when you specify the query. The following code is a more complex example that uses the DeviceID property:

<Query>associators of {win32_diskdrive='$Target/Property[Type="Windows!Microsoft.Windows.LogicalDevice"]/DeviceID$'} where ResultClass=Win32_DiskPartition</Query>

Important

For performance reasons, it is not advisable to use SELECT * in your WMI queries. Always perform SELECT commands on the required columns.

For more information about how to create WMI queries, see Querying WMI.

Composition

The Microsoft.Windows.WmiProbe module is a native module.

The module connects to the specified WMI namespace by calling IWbemLocator::ConnectServer. If the connection succeeds, it receives a pointer to the IWbemServices interface and calls IWbemServices::ExecQuery to run the query.

Errors

The errors listed in the following table can occur from within the Microsoft.Windows.WmiProbe module.

Exception Reason

10401

The module failed to connect to the WMI namespace.

10403

The module successfully connected to the WMI namespace after an error.

10404

The module cannot initialize due to wrong configuration parameter data.

10405

The module was unable to convert the input namespace to a local namespace.

10406

The module was unable to perform parameter replacement.

10407

The module failed to issue the query and will not able to receive events.

10408

The module was unable to create a property bag data item from the WMI object data.

10409

The module was unable to enumerate the WMI data.

10410

A large array was returned from the WMI object. This might indicate a misconfigured module.

Module Type Usage

Microsoft.Windows.WmiProvider

Queries Windows Management Instrumentation (WMI) for event or instance data and returns the information as a System.PropertyBagData type. This module is a trigger-only module.

External Module References

The Microsoft.Windows.WmiProbe module is a member of the modules described in the following table.

Module Type Library Usage

Microsoft.Windows.Discovery.WMISinglePropertyProvider2

Microsoft.Windows.Library

Queries WMI and returns the results as System.Discovery.Data type data.

Microsoft.Windows.WmiProvider

Microsoft.Windows.Library

Queries a WMI namespace as a data source module at a scheduled frequency and returns the results as System.PropertyBagData type data.

Microsoft.SystemCenter.NTService.Frequency.PerfCounterProvider

Microsoft.SystemCenter.Library

Queries WMI in order to retrieve performance data for the specified service.

Remarks

The Microsoft.Windows.WmiProbe module outputs one or more property-bag data items. The exact properties that are available in the output are dependent on the namespace and query that were specified.

The following code shows an example data item for a C: drive instance of the Win32_LogicalDisk class. This was generated by using the query select _CLASS, Access, Caption, Compressed from Win32_LogicalDisk where DeviceID=’C:’.

<DataItem type="System.PropertyBagData" time="2008-10-26T14:34:39.0657744-07:00" sourceHealthServiceId="B0BE86FA-56AD-1F2E-EE87-8DF72FC53818">
  <Property Name="__CLASS" VariantType="8">Win32_LogicalDisk</Property>
  <Property Name="Access" VariantType="18">0</Property>
  <Property Name="Caption" VariantType="8">C:</Property>
  <Property Name="Compressed" VariantType="11" Type="Boolean">false</Property>
</DataItem>

If the query that is specified returns multiple property bag data items, the workflow must be targeting a class that has multiple instances for the data to be used, and the data must have some property in it that can associate the correct property bag with the correct Operations Manager object.

For example, if you are monitoring logical disks and if a monitor is running that executes the query select DeviceID from Win32_LogicalDisk, the DeviceID property of the Operations Manager class type would be matched to the DeviceID WMI property in an expression module to filter out the other instances of logical disks.

Sample

The following example shows the Microsoft.Windows.WmiProbe module that is being used in a task that uses a property of the application to get data about the disk drive that the application is installed on:

<Task ID="Microsoft.Samples.GetLogicalDiskData" Accessibility="Internal" Target="Microsoft.Samples.ApplicationX">
  <Category>Operations</Category>
  <ProbeAction ID="Probe" TypeID="Windows!Microsoft.Windows.WmiProbe">
    <NameSpace>\\$Target/Host/Property[Type='Windows!Microsoft.Windows.Computer']/NetworkName$\root\cimv2</NameSpace>
    <Query>select DeviceID from win32_logicaldisk where DeviceID='$Target/Property[Type="Microsoft.Samples.ApplicationX"]/HostDrive$'</Query>
  </ProbeAction>
</Task>

Information

   

Module Type

ProbeActionModuleType

Input Type

System.BaseData

Output Type

System.PropertyBagData

Implementation

Native

Library

Microsoft.Windows.Library