Invoke PowerShell

Executes a PowerShell script or command and captures output and error streams.

Behaviour

Risk: High · Idempotent: No · Safe to retry: No · Recovery: Not replayed after a crash

Package System activities VeloPhex.System.Activities 0.7.1-rc.12 · Supported (Core profile) · type id velophex.system.invokePowerShell

Properties#

Input#

Command / Script#

Command · String · Required · Default: Not specified in package metadata

PowerShell script, or with Is Script off, the name of a command or cmdlet.

Is Script#

IsScript · Boolean? · Optional · Default: True

On: Command is script text. Off: Command is a command name, called with Parameters.

Parameters#

Parameters · IDictionary<String, Object> · Optional · Default: Not specified in package metadata

Named parameters, splatted onto the script or command: new Dictionary<string, object> { ["Path"] = folder }. A SecureString value arrives as a SecureString.

Variables#

Variables · IDictionary<String, Object> · Optional · Default: Not specified in package metadata

PowerShell variables set before the script runs, by name without $. A SecureString value arrives as a SecureString.

Input#

Input · IEnumerable<Object> · Optional · Default: Not specified in package metadata

Values piped into the script or command ($input).

Edition#

Edition · String · Optional · Default: WindowsPowerShell

Windows PowerShell 5.1 (powershell.exe) or PowerShell 7 (pwsh.exe, which must be installed).

Allowed values: WindowsPowerShell, PowerShell7.

Output Type#

OutputType · String · Optional · Default: Text

Text: Output is the pipeline as PowerShell prints it. Objects: Results holds each pipeline object, converted through JSON (depth 4).

Allowed values: Text, Objects.

Working Directory#

WorkingDirectory · String · Optional · Default: Not specified in package metadata

Working directory for execution.

Timeout (ms)#

TimeoutMS · Int32? · Optional · Default: 30000

How many milliseconds the script may run before it is stopped and the step fails.

Output#

Output#

Output · String · Output

Standard output produced by the script.

Results#

Results · IReadOnlyList<Object> · Output

With Output Type Objects: each pipeline object as a string, number, Boolean, list or dictionary.

Error Output#

ErrorOutput · String · Output

Standard error produced by the script.

Exit Code#

ExitCode · Int32 · Output

Process exit code.

Retry and risk#

This activity is not marked safe to retry: if it fails partway, check whether its work already happened before running it again. If a run is interrupted and the outcome of a step is unknown, the step is never retried automatically (what to do). How activities declare this: characteristics, retries and risk.

Every activity also has the engine's common properties: Timeout and Continue On Error.

Generated from VeloPhex.System.Activities 0.7.1-rc.12. Category: Invoke. Keywords: powershell, pwsh, script, command, shell.

Properties

Input

Output

Retry and risk

Related activities