CimIQL tutorial

This is a tutorial by example where each example builds on the previous example.

Table 1. CimIQL Tutorial
Order CimIQL Statement Result
1 CIM_ComputerSystem[0].* Retrieves the first result of all instances of CIM_ComputerSystem and its descendants. Retrieves all properties.
2 CIM_ComputerSystem.PrimaryOwnerContact Retrieves all instances of CIM_ComputerSystem and their descendants. Retrieves only one property, PrimaryOwnerContact.
3 CIM_ComputerSystem{CreationClassName='Linux_ComputerSystem',Name='runtime'}.* Retrieves a single unique instance of CIM_ComputerSystem and its descendants. All key tokens must be specified within the { } identity token.
4 CIM_ComputerSystem{{Name!='runtime'}}.*

Retrieves all instances and descendants of CIM_ComputerSystem that do not have a Name property of 'runtime'.

The filter token {{ }} filters out instances that do not contain all of the properties/keys specified.

5 CIM_ComputerSystem{{Name=/^run.*$/}}.*
Retrieves all instances and descendants of CIM_ComputerSystem that have a value matching the regular expression contained within the / / characters.
Note: The regular expression does not require single quotations.

The filter token {{ }} filters out instances that do not contain all of the properties/keys specified.

6 CIM_ComputerSystem{{Name='runtime'}}[2].*

Retrieves the second result of all instances of CIM_ComputerSystem and its descendants where the instances have a property Name of 'runtime'.

The order of operations follows the query syntax.
  1. Query server for all CIM_ComputerSystem and descendants.
  2. Filter results based on Name property.
  3. Retrieve the second instance that passed the filter.
7 CIM_ComputerSystem.CIM_RunningOS[0].Name

Retrieves the Name property for the first CIM_OperatingSystem instance of each CIM_ComputerSystem instance.

The middle-token, CIM_RunningOS, is the name of the Associator class, not the end-result.

8 CIM_ComputerSystem.CIM_RunningOS{{Name=/CentOS/}}[0].Name Retrieves the Name property for the first CIM_OperatingSystem instance of each CIM_ComputerSystem instance, where each CIM_OperatingSystem instance has a Name property containing 'CentOS'.