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.
To retrieve a qualifier using VBScript
- Retrieve the object whose qualifiers you want to view, as shown in the following example:
- Access the qualifiers of the object through the SWbemObject.Qualifiers_ property, as shown in the following example:
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++.
To retrieve a qualifier using C++
- Retrieve the object whose qualifiers you want to view.
- Retrieve the qualifier set for a given property with a call to IWbemClassObject::GetPropertyQualifierSet or IWbemClassObject::GetMethodQualifierSet methods.
- Access the qualifiers of the object through the returned IWbemQualifierSet interface.
For more information on retrieving qualifiers, see the Get-WmiClassMethodsAndWritableWmiProperties PowerShell code sample on the TechNet Gallery.