DIWbemServices.PutInstance

[This is preliminary documentation and subject to change.]

The DIWbemServices.PutInstance method creates or updates an instance of a class object to CIMOM.

DIWbemServices.PutInstance(
  [in] pInst As Object,           
  [in] lFlags As Long,                      
  [in] pCtx As Object,                       
  [out, OPTIONAL] ppCallResult As Object  
) As Long
 

Parameters

pInst
The instance to be written to the database.
lFlags
If WBEM_FLAG_CREATE_OR_UPDATE, the instance is created if it does not exist or overwritten if it already exists. If WBEM_FLAG_UPDATE_ONLY, the instance must exist and this call constitutes an update. If WBEM_FLAG_CREATE_ONLY, this call is for creation only, and the call fails if the instance already exists.
pCtx
Typically NOTHING. Otherwise, this is a DWbemContext object required by the dynamic class provider that is producing the class instances. The values in the context object must be specified in the documentation for the provider in question.
ppCallResult
If NOTHING, this is not used. If not NOTHING, call returns immediately with WBEM_NO_ERROR. An object of type DIWbemCallResult is then returned, and you can poll for the result of the operation by using the DIWbemCallResult.GetCallStatus method. The DIWbemCallResult.GetResultString contains the object path assigned to the object.

Return Values

WBEM_E_ACCESS_DENIED The current user does not have permission to update an instance of the specified class.
WBEM_E_ALREADY_EXISTS WBEM_FLAG_CREATE_ONLY flag was specified but the instance already exists.
WBEM_E_FAILED Unspecified error.
WBEM_E_ILLEGAL_NULL A value of NOTHING was specified for a property that may not be NOTHING, such as one that is marked by a key, indexed, or not_null qualifier.
WBEM_E_INVALID_OBJECT The specified instance is invalid (for example, PutInstance with a Class will invoke this return).
WBEM_E_INVALID_PARAMETER An invalid parameter was specified, or the namespace could not be parsed.
WBEM_E_NOT_FOUND WBEM_FLAG_UPDATE_ONLY flag was specified, but the instance does not exist.
WBEM_E_OUT_OF_MEMORY There was not enough memory to complete the operation.
WBEM_NO_ERROR Success.

See Also

DIWbemCallResult, DIWbemServices.PutInstanceAsync, Creating and Modifying an Instance