IWbemServices::DeleteClass

[This is preliminary documentation and subject to change.]

The IWbemServices::DeleteClass method deletes the specified class from the current namespace. If a dynamic instance provider is associated with the class, the provider is unregistered, and it is no longer called for that class. Any classes that derive from the deleted class are also deleted, and their associated providers are unregistered. All outstanding static instances of the specified class and its subclasses are also deleted when the class is deleted.

If the class is provided by a dynamic class provider, the success of the deletion depends on whether class deletion is supported by that provider.

Note  System classes cannot be deleted.

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

Parameters

bstrClass
The name of the class targeted for deletion.
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.
ppCallResultt
If NULL, the status of the call is returned in the HRESULT return code. If not NULL, the call becomes semisynchronous. The call returns immediately and this parameter receives a pointer to a new IWbemCallResult object that must be periodically polled by calling IWbemCallResult::GetCallStatus to determine the final status of the operation. Using this technique, many nonblocking calls to DeleteClass may occur before checking the status of any of them. In error cases where CIMOM cannot be reached, this parameter will be set to NULL.

See Error Objects.

Return Values

WBEM_E_ACCESS_DENIED The current user does not have permission to delete classes.
WBEM_E_FAILED Other unspecified errors.
WBEM_E_INVALID_CLASS The specified class does not exist.
WBEM_E_INVALID_OPERATION Deletion is not supported for the specified class. It may have been a system class or a class supplied by a dynamic provider that does not support class deletion.
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_E_TRANSPORT_FAILURE The communications link between the current process and CIMOM 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, IWbemServices::DeleteClassAsync