Partager via


PowerShell.BeginStop(AsyncCallback, Object) Method

Definition

Stop the currently running command asynchronously. If the command is not started, the state of PowerShell instance is changed to Stopped and corresponding events will be raised.

The returned IAsyncResult object can be used to wait for the stop operation to complete.

public:
 IAsyncResult ^ BeginStop(AsyncCallback ^ callback, System::Object ^ state);
public IAsyncResult BeginStop (AsyncCallback callback, object state);
member this.BeginStop : AsyncCallback * obj -> IAsyncResult
Public Function BeginStop (callback As AsyncCallback, state As Object) As IAsyncResult

Parameters

callback
AsyncCallback

A AsyncCallback to call once the BeginStop completes. Note: when using this API in script, don't pass in a delegate that is cast from a script block. The callback could be invoked from a thread without a default Runspace and a delegate cast from a script block would fail in that case.

state
Object

A user supplied state to call the callback with.

Returns

Exceptions

Object is disposed.

Applies to