IWbemServices::DeleteInstance

[This is preliminary documentation and subject to change.]

The IWbemServices::DeleteInstance method deletes the instance specified in the object path. Only instances in the current namespace can be deleted.

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

HRESULT IWbemServices::DeleteInstance(
  [in] BSTR bstrObjectPath,                          
  [in] LONG lFlags,                              
  [in] IWbemContext *pCtx,                        
  [out, OPTIONAL] IWbemCallResult **ppCallResult  
);
 

Parameters

bstrObjectPath
A valid BSTR containing the object path to the object to be deleted.
lFlags
Reserved. It must be zero.
pCtx
Typically NULL. Otherwise, this is a pointer to an IWbemContext 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 NULL, this parameter is not used. If ppCallResult is specified it must be set to point to NULL on entry. In this case, the call returns immediately with WBEM_NO_ERROR. ppCallResult receives a pointer to a new IWbemCallResult object, which must then be polled to obtain the result using the GetCallStatus method.

Return Values

WBEM_E_ACCESS_DENIED The current context does not have adequate rights to delete the object.
WBEM_E_FAILED Other unspecified errors.
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_E_TRANSPORT_FAILURE The communications link between CIMOM and the client has failed.
WBEM_NO_ERROR The call succeeded.

On failure, you can obtain any available information from the COM function GetErrorInfo.

See Also

Error Objects, IWbemCallResult, IWbemServices::DeleteInstanceAsync, Object Paths