Pipeline.Invoke Method

Definition

Overloads

Invoke(IEnumerable)

Invoke the pipeline, synchronously, returning the results as an array of objects.

Invoke()

Invoke the pipeline, synchronously, returning the results as an array of objects.

Invoke(IEnumerable)

Invoke the pipeline, synchronously, returning the results as an array of objects.

public:
 abstract System::Collections::ObjectModel::Collection<System::Management::Automation::PSObject ^> ^ Invoke(System::Collections::IEnumerable ^ input);
public abstract System.Collections.ObjectModel.Collection<System.Management.Automation.PSObject> Invoke (System.Collections.IEnumerable input);
abstract member Invoke : System.Collections.IEnumerable -> System.Collections.ObjectModel.Collection<System.Management.Automation.PSObject>
Public MustOverride Function Invoke (input As IEnumerable) As Collection(Of PSObject)

Parameters

input
IEnumerable

an array of input objects to pass to the pipeline. Array may be empty but may not be null

Returns

An array of zero or more result objects.

Exceptions

The thread in which the pipeline was executing was aborted.

  1. A pipeline is already executing. Pipeline cannot execute concurrently.
  2. Attempt is made to invoke a nested pipeline directly. Nested pipeline must be invoked from a running pipeline.

PipelineState is not NotStarted.

RunspaceState is not Open

Pipeline already disposed

The script recursed too deeply into script functions. There is a fixed limit on the depth of recursion.

A CLR security violation occurred. Typically, this happens because the current CLR permissions do not allow adequate reflection access to a cmdlet assembly.

Pipeline.Invoke can throw a variety of exceptions derived from RuntimeException. The most likely of these exceptions are listed below.

One of more parameters or parameter values specified for a cmdlet are not valid, or mandatory parameters for a cmdlet were not specified.

A cmdlet generated a terminating error.

A provider generated a terminating error.

The ActionPreference.Stop or ActionPreference.Inquire policy triggered a terminating error.

The pipeline was terminated asynchronously.

If there is an error generating the metadata for dynamic parameters.

Remarks

If using synchronous exectute, do not close input objectWriter. Synchronous invoke will always close the input objectWriter.

Applies to

Invoke()

Invoke the pipeline, synchronously, returning the results as an array of objects.

public:
 System::Collections::ObjectModel::Collection<System::Management::Automation::PSObject ^> ^ Invoke();
public System.Collections.ObjectModel.Collection<System.Management.Automation.PSObject> Invoke ();
member this.Invoke : unit -> System.Collections.ObjectModel.Collection<System.Management.Automation.PSObject>
Public Function Invoke () As Collection(Of PSObject)

Returns

Exceptions

The thread in which the pipeline was executing was aborted.

  1. A pipeline is already executing. Pipeline cannot execute concurrently.
  2. Attempt is made to invoke a nested pipeline directly. Nested pipeline must be invoked from a running pipeline.

PipelineState is not NotStarted.

RunspaceState is not Open

Pipeline already disposed

The script recursed too deeply into script functions. There is a fixed limit on the depth of recursion.

A CLR security violation occurred. Typically, this happens because the current CLR permissions do not allow adequate reflection access to a cmdlet assembly.

Pipeline.Invoke can throw a variety of exceptions derived from RuntimeException. The most likely of these exceptions are listed below.

One of more parameters or parameter values specified for a cmdlet are not valid, or mandatory parameters for a cmdlet were not specified.

A cmdlet generated a terminating error.

A provider generated a terminating error.

The ActionPreference.Stop or ActionPreference.Inquire policy triggered a terminating error.

The pipeline was terminated asynchronously.

If there is an error generating the metadata for dynamic parameters.

Remarks

If using synchronous invoke, do not close input objectWriter. Synchronous invoke will always close the input objectWriter.

Applies to