SWbemObject.DeleteAsync_ method

The DeleteAsync_ method of SWbemObject asynchronously deletes either the current class or the current instance. If a dynamic provider supplies the class or instance, sometimes it is not possible to delete this object unless the provider supports class or instance deletion.

For an explanation of this syntax, see Document Conventions for the Scripting API.


SWbemObject.DeleteAsync_( _
  ByVal objWbemSink, _
  [ ByVal iFlags ], _
  [ ByVal objwbemNamedValueSet ], _
  [ ByVal objWbemAsyncContext ] _


objWbemSink [in]

Object sink that returns the outcome of the delete operation.

iFlags [in, optional]

Integer that determines the behavior of the call. This parameter can accept the following values.

wbemFlagSendStatus (128 (0x80))

Causes asynchronous calls to send status updates to the SWbemSink.OnProgress event handler for the object sink.

wbemFlagDontSendStatus ( 0 (0x0))

Prevents asynchronous calls from sending status updates to the OnProgress event handler for the object sink.

objwbemNamedValueSet [in, optional]

This parameter is typically undefined. Otherwise, this is an SWbemNamedValueSet object whose elements represent the context information that can be used by the provider that is servicing the request. A provider that supports or requires such information must document the recognized value names, data type of the value, allowed values, and semantics.

objWbemAsyncContext [in, optional]

This is an SWbemNamedValueSet object that returns to the object sink to identify the source of the original asynchronous call. Use this parameter if you are making multiple asynchronous calls using the same object sink. To use this parameter, create an SWbemNamedValueSet object and use the SWbemNamedValueSet.Add method to add a value that identifies the asynchronous call you are making. This SWbemNamedValueSet object is returned to the object sink and the source of the call can be extracted using the SWbemNamedValueSet.Item method. For more information, see Calling a Method.

Return value

This method does not return a value. If this call is successful, the result of the delete operation is provided through the supplied object sink.

Error codes

After the completion of the DeleteAsync_ method, the Err object may contain one of the error codes in the following list.

wbemErrAccessDenied - 2147749891 (0x80041003)

Current context does not have adequate security rights to delete the object.

wbemErrFailed - 2147749890 (0x80041002)

Unspecified error.

wbemErrInvalidClass - 2147749904 (0x80041010)

Specified class does not exist.

wbemErrInvalidOperation - 2147749910 (0x80041016)

Object cannot be deleted.

wbemErrNotFound - 2147749890 (0x80041002)

Object did not exist.

wbemErrOutOfMemory - 2147749894 (0x80041006)

Not enough memory to complete the operation.


This call returns immediately. The status is returned to the caller through a callback delivered to the sink that is specified in objWbemSink.

An asynchronous callback allows a nonauthenticated user to provide data to the sink. This poses security risks to your scripts and applications. To eliminate the risks, use either semisynchronous communication or synchronous communication. For more information, see Calling a Method.


Minimum supported client
Windows Vista
Minimum supported server
Windows Server 2008
Type library