WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

WMI
plus
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Add Key Qualifier

 Keywords: ObjectType Add See Key Qualifier Property WMI True @True 1 -1

Question:

I can set the "key" property qualifier on a new WMI field called "Account" in VBScript using "key", True:
oDataObject.Properties_("Account").Qualifiers_.add "key" , True
But I can't set the "key" qualifier in WinBatch :
oSWbemLocator = ObjectCreate("WbemScripting.SWbemLocator")
oSWbemServices = oSWbemLocator.ConnectServer("", "root\CIMV2")
oDataObject = oSWbemServices.Get
oDataObject.Path_.Class = "BSC_Custom"
oDataObject.Properties_.add ("Account" , 8)
oDataObject.Properties_("Account").Qualifiers_.add("Key","TRUE")
oDataObject.Put_
I tried "TRUE", True, @TRUE, -1, 1, etc., but I can't set the "Key" qualifier in WMI. I can add the "Account" property OK without setting it as the "key", I just have problems marking the property with the "Key" qualifier.

Any help is appreciated.

Answer:

Use ObjectType
oDataObject.Properties_("Account").Qualifiers_.add("Key",ObjectType("BOOL", @TRUE))

Article ID:   W18464
Filename:   Add Key Qualifier.txt
File Created: 2012:06:22:09:20:16
Last Updated: 2012:06:22:09:20:16