88 Part II: WMI Queries and Events
Set colItems = objWMIService.execquery(wmiQuery)
For Each objItem in colItems
With
objItem
Wscript.Echo .path_.relpath
WScript.Echo vbtab & .displayName & vbcrlf & vbtab & .pathName
End with
Next
role
The last way to filter out references of queries in the Where clause is to use the role keyword. The
role keyword is used to specify associations that fill a particular role.
Using the ExecQuery Method
You will use the ExecQuery method many times. Remember, methods do something, so you
can use the ExecQuery method to retrieve a collection of objects from WMI. The objects are
returned as an SWbemObjectSet collection. In this section, we examine the use of ExecQuery,
the flags used to modify it, and the sp