[This is preliminary documentation and subject to change.]
The DWbemClassObject.Put method sets a named property to a new value. This method always overwrites the current value with the new one.
DWbemClassObject.Put(
[in] Name As String,
[in] lFlags As Long,
[in] pVal As VARIANT,
[in] vtType As Long
) As Long
Note
If pVal is NULL, the type of the property is inferred from the vtType parameter.
WBEM_E_FAILED | Unspecified error. |
WBEM_E_INVALID_PARAMETER | An invalid parameter was specified, or the namespace could not be parsed. |
WBEM_E_INVALID_PROPERTY_TYPE | Property type is not recognized. |
WBEM_E_OUT_OF_MEMORY | There was not enough memory to complete the operation. |
WBEM_E_TYPE_MISMATCH | For instances, this error code indicates that the pVal parameter is a VARIANT of an incorrect type for the property. For class definitions, this returns if the property already exists in the parent class, and the new COM type is different from the old COM type. Such properties are read-only for the derived class. |
WBEM_NO_ERROR | Success. |
If the property exists in the superclass, its default value is changed unless it is a type mismatch. If the property does not exist and it is not a type mismatch, the property is created.
When you execute this method on an instance, there will always be an overwrite. This is because the property always exists.
When you create a new class, and the underlying type of the property is an object reference, a date/time string, or other special type, it might be necessary to modify the CIMTYPE qualifier for the property to show the special new class. When you modify properties of an instance, set the qualifiers to the correct values ahead of time.
You can only write system properties when you create a new class. In that case, the name of the class you create is designated when you write it to the system property __CLASS.
System Classes, Properties, and Qualifiers