DWbemClassObject.Clone

[This is preliminary documentation and subject to change.]

The DWbemClassObject.Clone method returns a new object that is a clone of the current object.

DWbemClassObject.Clone(
  [out]  ppCopy As Object
) As Long
 

Parameters

ppCopy
Object of type DWbemClassObject. This parameter cannot be NOTHING. It receives the copy of the current object. On error, a new object is not returned.

Return Values

WBEM_E_FAILED Unspecified error..
WBEM_E_INVALID_PARAMETER NOTHING was specified as a parameter, and is not legal in this usage.
WBEM_E_OUT_OF_MEMORY There was not enough memory to clone the object.
WBEM_NO_ERROR Success.

Remarks

Use this method to duplicate a class definition, or to duplicate an instance. This is useful when you need the original copy of the object for backup purposes while you are modifying a new copy. Likewise, you can use this method to create many new instances from a single source instance. For example, you can use DWbemClassObject.SpawnInstance to create a single starting instance, and use DWbemClassObject.Clone to produce 100 copies of the instance quickly. Subsequently, you can modify each object to have specific values.

Note  It is not possible to use this method to convert a class definition into an instance, or to convert an instance into a class definition.