PowerShell.Invoke Method

Definition

Overloads

Invoke(IEnumerable, PSInvocationSettings)

Invoke the Command synchronously and return the output PSObject collection.

Invoke(IEnumerable)

Invoke the Command synchronously and return the output PSObject collection.

Invoke()

Invoke the Command synchronously and return the output PSObject collection.

Invoke<T>()

Invoke the Command synchronously and return the output.

Invoke<T>(IEnumerable)

Invoke the Command synchronously and return the output.

Invoke<T>(IEnumerable, IList<T>)

Invoke the Command synchronously and collect output data into the buffer output

Invoke<T>(IEnumerable, PSInvocationSettings)

Invoke the Command synchronously and return the output.

Invoke<T>(IEnumerable, IList<T>, PSInvocationSettings)

Invoke the Command synchronously and collect output data into the buffer output

Invoke<TInput,TOutput>(PSDataCollection<TInput>, PSDataCollection<TOutput>, PSInvocationSettings)

Invoke the Command synchronously and stream output data into the buffer output

Invoke(IEnumerable, PSInvocationSettings)

Invoke the Command synchronously and return the output PSObject collection.

public System.Collections.ObjectModel.Collection<System.Management.Automation.PSObject> Invoke (System.Collections.IEnumerable input, System.Management.Automation.PSInvocationSettings settings);
Parameters
input
IEnumerable

Input to the command

settings
PSInvocationSettings

Invocation Settings

Returns

Collection of PSObjects representing output.

Exceptions

Object is disposed.

Cannot perform the operation because the command is already started.Stop the command and try the operation again. (or) No commands are specified.

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 reflextion access to a cmdlet assembly.

The thread in which the command was executing was aborted.

PowerShell.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.

Invoke(IEnumerable)

Invoke the Command synchronously and return the output PSObject collection.

public System.Collections.ObjectModel.Collection<System.Management.Automation.PSObject> Invoke (System.Collections.IEnumerable input);
Parameters
input
IEnumerable

Input to the command

Returns

Collection of PSObjects representing output.

Exceptions

Object is disposed.

Cannot perform the operation because the command is already started.Stop the command and try the operation again. (or) No commands are specified.

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 reflextion access to a cmdlet assembly.

The thread in which the command was executing was aborted.

PowerShell.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.

Invoke()

Invoke the Command synchronously and return the output PSObject collection.

public System.Collections.ObjectModel.Collection<System.Management.Automation.PSObject> Invoke ();
Returns

collection of PSObjects.

Exceptions

Object is disposed.

Cannot perform the operation because the command is already started.Stop the command and try the operation again. (or) No commands are specified.

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 reflextion access to a cmdlet assembly.

The thread in which the command was executing was aborted.

PowerShell.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.

Invoke<T>()

Invoke the Command synchronously and return the output.

public System.Collections.ObjectModel.Collection<T> Invoke<T> ();
Type Parameters
T

Type of output object(s) expected from the command invocation.

Returns
Exceptions

Object is disposed.

Cannot perform the operation because the command is already started.Stop the command and try the operation again. (or) No commands are specified.

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 reflextion access to a cmdlet assembly.

The thread in which the command was executing was aborted.

PowerShell.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.

Invoke<T>(IEnumerable)

Invoke the Command synchronously and return the output.

public System.Collections.ObjectModel.Collection<T> Invoke<T> (System.Collections.IEnumerable input);
Type Parameters
T

Type of output object(s) expected from the command invocation.

Parameters
input
IEnumerable

Input to the command

Returns
Exceptions

Object is disposed.

Cannot perform the operation because the command is already started.Stop the command and try the operation again. (or) No commands are specified.

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 reflextion access to a cmdlet assembly.

The thread in which the command was executing was aborted.

PowerShell.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.

Invoke<T>(IEnumerable, IList<T>)

Invoke the Command synchronously and collect output data into the buffer output

public void Invoke<T> (System.Collections.IEnumerable input, System.Collections.Generic.IList<T> output);
Type Parameters
T

Type of output object(s) expected from the command invocation.

Parameters
input
IEnumerable

Input to the command

output
IList<T>

A collection supplied by the user where output is collected.

Exceptions

output cannot be null.

Object is disposed.

Cannot perform the operation because the command is already started.Stop the command and try the operation again. (or) No commands are specified.

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 reflextion access to a cmdlet assembly.

The thread in which the command was executing was aborted.

PowerShell.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.

Invoke<T>(IEnumerable, PSInvocationSettings)

Invoke the Command synchronously and return the output.

public System.Collections.ObjectModel.Collection<T> Invoke<T> (System.Collections.IEnumerable input, System.Management.Automation.PSInvocationSettings settings);
Type Parameters
T

Type of output object(s) expected from the command invocation.

Parameters
input
IEnumerable

Input to the command

settings
PSInvocationSettings

Invocation Settings

Returns
Exceptions

Object is disposed.

Cannot perform the operation because the command is already started.Stop the command and try the operation again. (or) No commands are specified.

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 reflextion access to a cmdlet assembly.

The thread in which the command was executing was aborted.

PowerShell.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.

Invoke<T>(IEnumerable, IList<T>, PSInvocationSettings)

Invoke the Command synchronously and collect output data into the buffer output

public void Invoke<T> (System.Collections.IEnumerable input, System.Collections.Generic.IList<T> output, System.Management.Automation.PSInvocationSettings settings);
Type Parameters
T

Type of output object(s) expected from the command invocation.

Parameters
input
IEnumerable

Input to the command

output
IList<T>

A collection supplied by the user where output is collected.

settings
PSInvocationSettings

Invocation Settings to use.

Exceptions

output cannot be null.

No commands are specified.

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 reflextion access to a cmdlet assembly.

The thread in which the command was executing was aborted.

PowerShell.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.

Invoke<TInput,TOutput>(PSDataCollection<TInput>, PSDataCollection<TOutput>, PSInvocationSettings)

Invoke the Command synchronously and stream output data into the buffer output

public void Invoke<TInput,TOutput> (System.Management.Automation.PSDataCollection<TInput> input, System.Management.Automation.PSDataCollection<TOutput> output, System.Management.Automation.PSInvocationSettings settings);
Type Parameters
TInput

Type of input object(s) expected from the command invocation.

TOutput

Type of output object(s) expected from the command invocation.

Parameters
input
PSDataCollection<TInput>

Input to the command

output
PSDataCollection<TOutput>

Output of the command.

settings
PSInvocationSettings

Invocation Settings to use.

Exceptions

output cannot be null.

No commands are specified.

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 reflextion access to a cmdlet assembly.

The thread in which the command was executing was aborted.

PowerShell.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.