WMI Use Case

Prev Next

A Discovery extension supplements the information collected during a discovery job. It runs commands through the Protocol used by the job and uses their results to:

  • Create Custom Attributes that are not part of the standard inventory.

  • Replace a standard inventory value with a value returned by an extension command.

  • Populate a standard inventory value only when normal discovery does not return that value.

This example explains how to configure a WMI Command set for a Windows device. The command set collects the system name as a Custom attribute and shows how a WMI query can update a standard inventory field.

Protocol: Run a WMI discovery job to execute a WMI command set.

Example scenario

An infrastructure administrator manages Windows devices discovered through WMI. Standard discovery collects the device inventory, but the administrator also wants to:

  1. Store the system name returned by WMI as a custom attribute named System Name.

  2. Replace the standard node.fqdn inventory field with a value returned by a WMI query.

  3. Run the added commands only on devices that match the selected Windows OS Filter.

To meet these requirements, the administrator creates a WMI command set, selects the applicable Windows OS filter, adds the commands, and runs a WMI discovery job against the target devices.

How the configuration works

The command set contains the following example commands:

Command

Trigger

WQL query

Result column

Inventory result

System Name

New Field

SELECT Name FROM Win32_ComputerSystem

Leave blank to use the first column (Name).

Creates a custom attribute with the key system_name.

FQDN New

Override

SELECT SystemType FROM Win32_ComputerSystem

Leave blank to use the first column (SystemType).

Replaces the standard node.fqdn value with the query result.

Important

The screenshot maps the SystemType query result to node.fqdn. SystemType describes the computer architecture, not its fully qualified domain name. Confirm that this mapping is intentional. To populate an FQDN field, use a query result that contains the intended FQDN.

For both commands, select First Line in Output Parser. WMI first reads the selected WQL Result Column; when that field is blank, it uses the first column returned by the query. The output parser processes that value before Discovery stores it.

Figure: WMI Command Set

Figure: WMI Command Set

WMI discovery flow

  1. The WMI discovery job connects to the target Windows device using the configured discovery account.

  2. Standard WMI discovery identifies the operating system and collects the normal device inventory.

  3. The extension checks whether the discovered operating system matches the command-set OS filter.

  4. If the filter matches, the extension runs each enabled WQL query in the command set.

  5. For each query, Discovery reads the configured WQL Result Column, or the first column when the field is blank.

  6. The configured output parser processes the query result.

  7. Discovery saves the parsed value as a custom attribute or standard inventory field, based on the selected trigger.

  8. The updated values appear on the Discovered Device Details page after the job completes.

Trigger options

Each command uses a trigger to determine how Discovery stores the parsed query result.

New Field

Use New Field to create a custom attribute without changing a standard inventory field.

Configure the command with:

  • Command Name: System Name

  • Trigger: New Field - add as custom attribute

  • Custom Attribute Key: system_name

  • WQL Query: SELECT Name FROM Win32_ComputerSystem

  • WQL Result Column: Leave blank to use the first column, Name

  • Output Parser: First Line

Result: The Custom Attributes tab displays the value returned for system_name.

Figure: Custom Attributes - WMI

Figure: Custom Attributes - WMI

Override

Use Override to replace a selected standard inventory field whenever the WMI query returns a usable value.

Configure the command with:

  • Command Name: FQDN New (as shown in the example configuration)

  • Trigger: Override - always overwrite standard field

  • Standard Field to Set: node.fqdn

  • WQL Query: SELECT SystemType FROM Win32_ComputerSystem (as shown in the example configuration)

  • WQL Result Column: Leave blank to use the first column, SystemType

  • Output Parser: First Line

Result: Discovery replaces the standard node.fqdn value with the parsed query result. Verify that the query returns an appropriate FQDN value before using this mapping; SystemType normally returns architecture information.

Figure: Custom Attributes - WMI

Figure: Custom Attributes - WMI

Caution: Override replaces the existing standard value. Use it only when the query output is appropriate for the selected field and more reliable or better formatted than the value collected through standard discovery.

In the following example, the WMI extension is not applied, or the administrator disables the extension before running the WMI job. You do not see custom attributes, and the FQDN value does not change as defined in the extension.

Figure: Discovery Extension job not applied

Figure: Discovery Extension job not applied

Now, the WMI extension is active, and the WMI job runs. You can see Custom Attributes on the Discovered Devices page and the FQDN change.

Figure: Discovery Extension job applied

Figure: Discovery Extension job applied