Export (0) Print
Expand All

Accessing a Qualifier

A qualifier is a tag that provides more information about a WMI object, method, or property. At times, you may need to access the data stored in a qualifier. For example, a common task is to determine if a provider implements a method by attempting to retrieve the Implemented qualifier for that method. For more information, see WMI Qualifiers and Adding a Qualifier.

The following procedure describes how to retrieve a qualifier using VBScript.

Aa384701.wedge(en-us,VS.85).gifTo retrieve a qualifier using VBScript

  1. Retrieve the object whose qualifiers you want to view, as shown in the following example:
    Set Process = GetObject("winmgmts:Win32_Process")
    

    The most common way to retrieve an object is by using the GetObject method. For more information, see Retrieving an Instance.

  2. Access the qualifiers of the object through the SWbemObject.Qualifiers_ property, as shown in the following example:
    for each Qualifier in Process.Qualifiers_
        WScript.Echo " " & Qualifier.Name
    next
    

The following code example describes how to access all the qualifiers on a Win32_Process object.

On Error Resume Next
Set Process = GetObject("winmgmts:Win32_Process")
WScript.Echo ""
WScript.Echo "Class name is", Process.Path_.Class

'Get the qualifiers
WScript.Echo ""
WScript.Echo "Qualifiers:"
WScript.Echo ""
for each Qualifier in Process.Qualifiers_
    WScript.Echo " " & Qualifier.Name
next

if Err <> 0 Then
    WScript.Echo Err.Description
    Err.Clear
End if

The following procedure describes how to retrieve a qualifier using C++.

Aa384701.wedge(en-us,VS.85).gifTo retrieve a qualifier using C++

  1. Retrieve the object whose qualifiers you want to view.

    The most common way to retrieve an object is by using a call to GetObject or GetObjectAsync. For more information, see Retrieving Class or Instance Data.

  2. Retrieve the qualifier set for a given property with a call to IWbemClassObject::GetPropertyQualifierSet or IWbemClassObject::GetMethodQualifierSet methods.
  3. Access the qualifiers of the object through the returned IWbemQualifierSet interface.

Examples

For more information on retrieving qualifiers, see the Get-WmiClassMethodsAndWritableWmiProperties PowerShell code sample on the TechNet Gallery.

 

 

Show:
© 2014 Microsoft