SWbemPropertySet.Add method

The Add method of the SWbemPropertySet object adds an SWbemProperty object to the SWbemPropertySet collection. If a property with the same name already exists in the collection, its contents are replaced with the new definition.

Note

The value of the added property is NULL (unassigned) after this operation. To set or change the value of a WMI property, you must set the Value property of the returned SWbemProperty object.

For an explanation of this syntax, see Document Conventions for the Scripting API.

Syntax

objProperty = .Add( _
  ByVal strName, _
  ByVal iCIMType, _
  [ ByVal bIsArray ], _
  [ ByVal iFlags ] _
)

Parameters

strName [in]

Required. Name of the new property.

iCIMType [in]

Required. An integer that represents the CIMType qualifier of the new property. See WbemCimTypeEnum for the list with the CIMType qualifiers and their values.

bIsArray [in, optional]

Specifies whether the property is an array type. The default value for this parameter is FALSE.

iFlags [in, optional]

Reserved and must be zero if specified.

Return value

If successful, this method returns an SWbemProperty object that represents the new property. Otherwise, a null object is returned.

Error codes

After completion of the Add method, the Err object may contain one of the error codes below.

wbemErrFailed - 2147749889 (0x80041001)

Unspecified failure.

wbemErrInvalidParameter - 2147749896 (0x80041008)

Invalid parameter was specified.

wbemErrOutOfMemory - 2147749894 (0x80041006)

Not enough memory for this method to execute.

wbemErrInvalidPropertyType - 2147749930

The CIMType qualifier is not recognized.

Examples

For a code example that uses this method, see the SWbemPropertySet topic.

Requirements

Requirement Value
Minimum supported client
Windows Vista
Minimum supported server
Windows Server 2008
Header
Wbemdisp.h
Type library
Wbemdisp.tlb
DLL
Wbemdisp.dll
CLSID
CLSID_SWbemPropertySet
IID
IID_ISWbemPropertySet

See also

SWbemPropertySet

SWbemPropertySet.Remove

SWbemProperty.Value