PowerShell.Invoke Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
Invoke() |
Invoke the Command synchronously and return the output PSObject collection. |
Invoke(IEnumerable) |
Invoke the Command synchronously and return the output PSObject collection. |
Invoke(IEnumerable, PSInvocationSettings) |
Invoke the Command synchronously and return the output PSObject collection. |
Invoke<T>(IEnumerable, IList<T>, PSInvocationSettings) |
Invoke the Command synchronously and collect
output data into the buffer |
Invoke<T>(IEnumerable, IList<T>) |
Invoke the Command synchronously and collect
output data into the buffer |
Invoke<T>(IEnumerable, PSInvocationSettings) |
Invoke the Command synchronously and return the output. |
Invoke<T>() |
Invoke the Command synchronously and return the output. |
Invoke<T>(IEnumerable) |
Invoke the Command synchronously and return the output. |
Invoke<TInput,TOutput>(PSDataCollection<TInput>, PSDataCollection<TOutput>, PSInvocationSettings) |
Invoke the Command synchronously and stream
output data into the buffer |
Invoke()
Invoke the Command synchronously and return the output PSObject collection.
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
collection of PSObjects.
Exceptions
The thread in which the command was executing was aborted.
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 reflection access to a cmdlet assembly.
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.
Applies to
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);
public System.Collections.ObjectModel.Collection<System.Management.Automation.PSObject> Invoke (System.Collections.IEnumerable input);
member this.Invoke : System.Collections.IEnumerable -> System.Collections.ObjectModel.Collection<System.Management.Automation.PSObject>
Public Function Invoke (input As IEnumerable) As Collection(Of PSObject)
Parameters
- input
- IEnumerable
Input to the command
Returns
Collection of PSObjects representing output.
Exceptions
The thread in which the command was executing was aborted.
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 reflection access to a cmdlet assembly.
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.
Applies to
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);
public System.Collections.ObjectModel.Collection<System.Management.Automation.PSObject> Invoke (System.Collections.IEnumerable input, System.Management.Automation.PSInvocationSettings settings);
member this.Invoke : System.Collections.IEnumerable * System.Management.Automation.PSInvocationSettings -> System.Collections.ObjectModel.Collection<System.Management.Automation.PSObject>
Public Function Invoke (input As IEnumerable, settings As PSInvocationSettings) As Collection(Of PSObject)
Parameters
- input
- IEnumerable
Input to the command
- settings
- PSInvocationSettings
Invocation Settings
Returns
Collection of PSObjects representing output.
Exceptions
The thread in which the command was executing was aborted.
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 reflection access to a cmdlet assembly.
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.
Applies to
Invoke<T>(IEnumerable, IList<T>, PSInvocationSettings)
Invoke the Command synchronously and collect
output data into the buffer output
public:
generic <typename T>
void Invoke(System::Collections::IEnumerable ^ input, System::Collections::Generic::IList<T> ^ output, System::Management::Automation::PSInvocationSettings ^ settings);
public void Invoke<T> (System.Collections.IEnumerable input, System.Collections.Generic.IList<T> output, System.Management.Automation.PSInvocationSettings settings);
member this.Invoke : System.Collections.IEnumerable * System.Collections.Generic.IList<'T> * System.Management.Automation.PSInvocationSettings -> unit
Public Sub Invoke(Of T) (input As IEnumerable, output As IList(Of T), settings As PSInvocationSettings)
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
The thread in which the command was executing was aborted.
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 reflection access to a cmdlet assembly.
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.
Applies to
Invoke<T>(IEnumerable, IList<T>)
Invoke the Command synchronously and collect
output data into the buffer output
public:
generic <typename T>
void Invoke(System::Collections::IEnumerable ^ input, System::Collections::Generic::IList<T> ^ output);
public void Invoke<T> (System.Collections.IEnumerable input, System.Collections.Generic.IList<T> output);
member this.Invoke : System.Collections.IEnumerable * System.Collections.Generic.IList<'T> -> unit
Public Sub Invoke(Of T) (input As IEnumerable, output As IList(Of T))
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
The thread in which the command was executing was aborted.
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 reflection access to a cmdlet assembly.
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.
Applies to
Invoke<T>(IEnumerable, PSInvocationSettings)
Invoke the Command synchronously and return the output.
public:
generic <typename T>
System::Collections::ObjectModel::Collection<T> ^ Invoke(System::Collections::IEnumerable ^ input, System::Management::Automation::PSInvocationSettings ^ settings);
public System.Collections.ObjectModel.Collection<T> Invoke<T> (System.Collections.IEnumerable input, System.Management.Automation.PSInvocationSettings settings);
member this.Invoke : System.Collections.IEnumerable * System.Management.Automation.PSInvocationSettings -> System.Collections.ObjectModel.Collection<'T>
Public Function Invoke(Of T) (input As IEnumerable, settings As PSInvocationSettings) As Collection(Of T)
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
The thread in which the command was executing was aborted.
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 reflection access to a cmdlet assembly.
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.
Applies to
Invoke<T>()
Invoke the Command synchronously and return the output.
public:
generic <typename T>
System::Collections::ObjectModel::Collection<T> ^ Invoke();
public System.Collections.ObjectModel.Collection<T> Invoke<T> ();
member this.Invoke : unit -> System.Collections.ObjectModel.Collection<'T>
Public Function Invoke(Of T) () As Collection(Of T)
Type Parameters
- T
Type of output object(s) expected from the command invocation.
Returns
Exceptions
The thread in which the command was executing was aborted.
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 reflection access to a cmdlet assembly.
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.
Applies to
Invoke<T>(IEnumerable)
Invoke the Command synchronously and return the output.
public:
generic <typename T>
System::Collections::ObjectModel::Collection<T> ^ Invoke(System::Collections::IEnumerable ^ input);
public System.Collections.ObjectModel.Collection<T> Invoke<T> (System.Collections.IEnumerable input);
member this.Invoke : System.Collections.IEnumerable -> System.Collections.ObjectModel.Collection<'T>
Public Function Invoke(Of T) (input As IEnumerable) As Collection(Of T)
Type Parameters
- T
Type of output object(s) expected from the command invocation.
Parameters
- input
- IEnumerable
Input to the command
Returns
Exceptions
The thread in which the command was executing was aborted.
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 reflection access to a cmdlet assembly.
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.
Applies to
Invoke<TInput,TOutput>(PSDataCollection<TInput>, PSDataCollection<TOutput>, PSInvocationSettings)
Invoke the Command synchronously and stream
output data into the buffer output
public:
generic <typename TInput, typename TOutput>
void Invoke(System::Management::Automation::PSDataCollection<TInput> ^ input, System::Management::Automation::PSDataCollection<TOutput> ^ output, System::Management::Automation::PSInvocationSettings ^ settings);
public void Invoke<TInput,TOutput> (System.Management.Automation.PSDataCollection<TInput> input, System.Management.Automation.PSDataCollection<TOutput> output, System.Management.Automation.PSInvocationSettings settings);
member this.Invoke : System.Management.Automation.PSDataCollection<'Input> * System.Management.Automation.PSDataCollection<'Output> * System.Management.Automation.PSInvocationSettings -> unit
Public Sub Invoke(Of TInput, TOutput) (input As PSDataCollection(Of TInput), output As PSDataCollection(Of TOutput), settings As PSInvocationSettings)
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
The thread in which the command was executing was aborted.
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 reflection access to a cmdlet assembly.
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.