DIWbemServices.DeleteInstance

[This is preliminary documentation and subject to change.]

The DIWbemServices.DeleteInstance method deletes the instance specified in the object path. You can only delete instances in the current namespace.

If a dynamic provider supplied the instance, it is sometimes not possible to delete the instance unless the provider supports instance deletion.

DIWbemServices.DeleteInstance(
  [in]  ObjectPath As String,                          
  [in] lFlags As Long,                              
  [in] pCtx As Object,                        
  [out, OPTIONAL] ppCallResult As Object 
) As Long
 

Parameters

ObjectPath
A string containing the object path to the object to be deleted.
lFlags
Reserved. It must be zero.
pCtx
Typically NOTHING. Otherwise, this is a DWbemContext object required by the dynamic class provider that is producing the class instances. You must specify the values in the context object in the documentation for the provider in question.
ppCallResult
If NOTHING, this parameter is not used. If you specify ppCallResul,the call returns immediately with WBEM_NO_ERROR, and ppCallResult receives a new DIWbemCallResult object. This object must be polled, using the GetCallStatus method, to obtain the result.

Return Values

WBEM_E_ACCESS_DENIED The current context does not have adequate rights to delete the object.
WBEM_E_FAILED Unspecified error.
WBEM_E_INVALID_CLASS The specified class does not exist.
WBEM_E_INVALID_OPERATION The object cannot be deleted.
WBEM_E_NOT_FOUND The object did not exist.
WBEM_E_OUT_OF_MEMORY There was not enough memory to complete the operation.
WBEM_NO_ERROR Success.

For more information on return values see Visual Basic error handeling and return values

See Also

Error Objects, DIWbemCallResult, DIWbemServices.DeleteInstanceAsync, Object Paths