IWbemServices::DeleteClass method
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 by 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 a dynamic class provider provides the class, the success of the deletion depends on whether the provider supports class deletion.
Note System classes cannot be deleted.
Syntax
HRESULT DeleteClass( [in] const BSTR strClass, [in] LONG lFlags, [in] IWbemContext *pCtx, [out] IWbemCallResult **ppCallResult );
Parameters
- strClass [in]
-
Name of the class targeted for deletion.
- lFlags [in]
-
One of the following values can be set.
Flag Meaning - WBEM_FLAG_RETURN_IMMEDIATELY
This flag causes this to be a semisynchronous call. For more information, see Calling a Method.
- WBEM_FLAG_OWNER_UPDATE
Indicates that the caller is a push provider.
- pCtx [in]
-
Typically NULL. Otherwise, this is a pointer to an IWbemContext object that may be used by the provider deleting the class. The values in the context object must be specified in the documentation for the provider in question. For more information about this parameter, see Making Calls to WMI.
- ppCallResult [out]
-
If NULL, this parameter is not used. If ppCallResult is specified, it must be set to point to NULL on entry. If the lFlags parameter contains WBEM_FLAG_RETURN_IMMEDIATELY, this call returns immediately with WBEM_S_NO_ERROR. The ppCallResult parameter receives a pointer to a new IWbemCallResult object, which can then be polled to obtain the result using the GetCallStatus method.
Return value
This method returns an HRESULT indicating the status of the method call. The following table lists the value contained within an HRESULT.
On failure, you can obtain any available information from the COM function GetErrorInfo.
COM-specific error codes may also be returned if network problems cause you to lose the remote connection to Windows Management.
| Return code | Description |
|---|---|
|
The current user does not have permission to delete classes. |
|
This indicates other unspecified errors. |
|
The specified class does not exist. |
|
Deleting this class would invalidate a subclass. |
|
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. |
|
A specified parameter is not valid. |
|
There was not enough memory to complete the operation. |
|
Windows Management service was probably stopped and restarted. A new call to ConnectServer is needed. |
|
This indicates the failure of the remote procedure call (RPC) link between the current process and Windows Management. |
|
The call succeeded. |
Examples
For script code examples, see WMI Tasks for Scripts and Applications and the TechNet ScriptCenter Script Repository.
For C++ code examples, see WMI C++ Application Examples.
Requirements
|
Minimum supported client | Windows 2000 Professional [desktop apps only] |
|---|---|
|
Minimum supported server | Windows 2000 Server [desktop apps only] |
|
Header |
|
|
Library |
|
|
DLL |
|
See also
Send comments about this topic to Microsoft
Build date: 11/19/2012