Reputation: 273
I have been looking for a way to programmatically output the Description of a WMI class property, but cannot find out how to access the amended qualifier.
I have seen this question on how to use VBScript to display WMI class descriptions, using the following snippet:
Const wbemFlagUseAmendedQualifiers = &H20000
Set oWMI = GetObject("winmgmts:\\.\root\cimv2")
Set oClass = oWMI.Get("Win32_OperatingSystem", wbemFlagUseAmendedQualifiers)
WScript.Echo oClass.Qualifiers_("Description").Value
The following image is what I want to extract, shown in WMI Code Creator:
Is there a method like this that could display the Description?
Set oWMI = GetObject("winmgmts:\\.\root\cimv2")
Set oProp = oWMI.Get("Win32_OperatingSystem.BootDevice", wbemFlagUseAmendedQualifiers)
WScript.Echo oProp.Qualifiers_("Description").Value
Upvotes: 2
Views: 770
Reputation: 97847
You're almost there. Take your first example and insert Properties_("BootDevice")
into the last line:
Const wbemFlagUseAmendedQualifiers = &H20000
Set oWMI = GetObject("winmgmts:\\.\root\cimv2")
Set oClass = oWMI.Get("Win32_OperatingSystem", wbemFlagUseAmendedQualifiers)
WScript.Echo oClass.Properties_("BootDevice").Qualifiers_("Description").Value
Or if you need to loop through all class properties:
...
On Error Resume Next
For Each oProp in oClass.Properties_
WScript.Echo oProp.Name & ": " & oProp.Qualifiers_("Description").Value
Next
Upvotes: 3