[This is preliminary documentation and subject to change.]
Use the DWbemClassObject.SpawnInstance method to create a new instance of a class. The current object must be a class definition obtained from CIMOM using DIWbemServices.GetObject or DIWbemServices.CreateClassEnum. Then use this class definition to create new instances. Create each new instance locally within the process, and then call DIWbemServices.PutInstance to actually create the instance within CIMOM.
Note that spawning an instance from an instance is legal.
DWbemClassObject.SpawnInstance(
[in] lFlags As Long,
[out] ppNewInstance As Object
) As Long
WBEM_E_INCOMPLETE_CLASS | The current object is not a valid class definition, and it cannot spawn new instances. Either it is incomplete, or it has not been registered with CIMOM using PutClass. |
WBEM_E_ILLEGAL_OPERATION | Returned if this method is used on an instance instead of a class |
WBEM_E_INVALID_PARAMETER | An invalid parameter was specified, or the namespace could not be parsed. |
WBEM_E_OUT_OF_MEMORY | There was not enough memory to complete the operation. |
WBEM_NO_ERROR | Success. |
DIWbemServices.GetObject, DIWbemServices.PutInstance