Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

Pipeline.InvokeAsync Method

Invokes the pipeline asynchronously.


Namespace: System.Management.Automation.Runspaces
Assembly: System.Management.Automation (in System.Management.Automation.dll)

'Usage
Dim instance As Pipeline

instance.InvokeAsync

public abstract void InvokeAsync ()
public abstract void InvokeAsync ()
public abstract function InvokeAsync ()

Exception typeCondition
InvalidOperationException

One of the following error conditions occurred:

  • No command is added to the pipeline.

  • The pipeline is already executing.

  • The pipeline is nested. Nested pipelines cannot be executed asynchronously.

InvalidPipelineStateException

The pipeline is not in the NotStarted state.

InvalidRunspaceStateException

The runspace is not in the Opened state.

Results are returned through the pipeline output reader that can be accessed through the Output property.

When this method is used to invoke the pipeline asynchronously, the Input writer must be closed before the pipeline invocation can be completed.

This method cannot be called when another pipeline is running.

This method cannot be called multiple times on a given pipeline. The state of the pipeline must be NotStarted when this method is called. After it is called, it changes the state of the pipeline to Running. When the method is completed, it changes the state of pipeline to one of following:

  • Completed: The pipeline state is Completed if the pipeline invocation completed successfully.

  • Failed: The pipeline state is Failed if the pipeline invocation failed or one of the commands in the pipeline threw a terminating error.

  • Stopped: The pipeline state is Stopped if the pipeline was stopped by calling Stop or StopAsync.

Applications can get notified of pipeline state changes by registering for the StateChanged event. This event is raised each time the state of the pipeline changes.


Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

 

Target Platforms


Show:
© 2015 Microsoft