PowerShell.BeginInvoke<TInput, TOutput> Method (PSDataCollection<TInput>, PSDataCollection<TOutput>, PSInvocationSettings, AsyncCallback, Object)


Updated: April 27, 2016

Applies To: Windows PowerShell

Asynchronously runs the commands of the PowerShell object pipeline by using a specified input buffer, invocation settings, callback method, and output buffer. This method is introduced in Windows PowerShell 2.0.

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

public IAsyncResult BeginInvoke<TInput, TOutput>(
	PSDataCollection<TInput> input,
	PSDataCollection<TOutput> output,
	PSInvocationSettings settings,
	AsyncCallback callback,
	object state


Type: System.Management.Automation.PSDataCollection<TInput>

A PSDataCollection<T> of type parameter TInput that contains input data for the first command of the pipeline.

Type: System.Management.Automation.PSDataCollection<TOutput>

A PSDataCollection<T> of type parameter TOutput that contains the output of the pipeline.

Type: System.Management.Automation.PSInvocationSettings

A PSInvocationSettings object that specifies Windows PowerShell defined options used when invoking the commands, such as which host should be used when the commands are invoked.

Type: System.AsyncCallback

An AsyncCallback delegate that references a call to make when the BeginInvoke<TInput, TOutput> call is complete.

Type: System.Object

A user-supplied state to use when the callback method is called.

Return Value

Type: System.IAsyncResult

An IAsyncResult interface that represents the status of the asynchronous operation. The EndInvoke method uses this interface to determine when to return the results of the operation to the supplied output buffer.

When this method is used, calls to the EndInvoke method return a null buffer.

Type Parameters


The type of the objects used as input to the first command of the pipeline.


The type of the output objects expected from invoking the commands of the pipeline.

Exception Condition

Cannot perform the operation because the operation is already started, or there are no commands in the pipeline.


The PowerShell object is disposed.

When this method is called, invocation does not begin until the application completes adding data to the buffer. The caller of the BeginInvoke<TInput, TOutput> must call Complete after all input is written to the input buffer. If you do not call the Complete method, Windows PowerShell will continue to wait for input data and not invoke the pipeline. If you observe that the invocation is not doing anything, this might be the reason.

Return to top

Community Additions