Skip to main content

Run PowerShell Script

Run PowerShell Script executes a .ps1 script through a Command Runner policy. The script path must resolve under that runner's Allowed Paths.

It is the PowerShell counterpart to Run Bash Script, with one additional setting: Use -Command (instead of -File) changes how the script is handed to PowerShell.

The activity has four tabs: Configuration, Arguments, Environment, and Output.

Configuration

FieldRequiredDescription
NameOptionalName of the component.
DescriptionOptionalDescription of the component.
Command RunnerOptionalThe Command Runner policy resource that gates this execution.
Script PathOptionalPath to the .ps1 script; must resolve under the runner's Allowed Paths.
Use -Command (instead of -File)OptionalWhen enabled the script is passed via -Command rather than -File. Defaults to cleared.
Working DirectoryOptionalMust be under the runner's Allowed Paths. Defaults to the first Allowed Paths entry.
Standard InputOptionalText written to the process stdin, which is then closed.

Script Path, Working Directory, and Standard Input each support mapped and vault-backed values.

Arguments

FieldRequiredDescription
ArgumentsOptionalArguments passed after the script path, each a discrete array element.

Environment

FieldRequiredDescription
Environment OverridesOptionalPer-run environment variables applied on top of the runner's environment.

Values are mapping and vault capable.

Output

The activity returns a scriptOutput object.

FieldData TypeDescription
exitCodeIntegerProcess exit code.
stdoutStringCaptured standard output.
stderrStringCaptured standard error.
durationMsIntegerRun duration in milliseconds.
timedOutBooleanWhether the run exceeded Max Runtime (seconds) on the Command Runner.
truncatedBooleanWhether output exceeded Max Output Bytes (per stream) and was cut short.