Process: Run PowerShell script

Run a PowerShell script and capture its output.

Help Centre › Building Processes

Run a PowerShell script and capture its output.

Add it to a process

In the process designer, open the Add step tab. Find Run PowerShell script under Process, or type its name in the search box, and drag it onto the canvas.

Fields

FieldRequiredWhat it does
ScriptNoThe PowerShell script to run (use this or path, not both)
Or a script fileNoPath to an existing .ps1 file to run instead of an inline script
Output variableNoName of the variable where the result will be stored
Parse output as JSONNoParse the output as JSON into a structured variable; end the script with `| ConvertTo-Json`
ArgumentsNoArguments passed to the script
Exit-code variableNoVariable to store the exit code, for branching on success
Full-result variableNoVariable to store the full result object (stdout, stderr, exit code, duration)
Timeout (seconds)NoSeconds to wait before the script is stopped (default 60, 0 for no limit)
Standard inputNoText piped to the script's standard input
Working directoryNoWorking directory to run the script in
Environment variablesNoExtra environment variables for the script
Window styleNoConsole window style (Windows only) Choices: Normal, Hidden, Minimized, Maximized.
Fail on non-zero exitNoFail the step when the script exits non-zero (default true) Default: on.
Inherit environmentNoPass the bot's own environment to the script (default true)
Run as AdministratorNoRun elevated. Windows only, and needs a human at the UAC prompt

What it gives back

  • {variable} – The script's output - a string, or the parsed record when json is true
  • {exit_code_variable} – The script's exit code
  • {result_variable} – {command, stdout, stderr, exit code, pid, timed out, duration, succeeded}

See all Process steps.

See it working on your own data

Everything documented here ships with the platform – try the document tools free, or go live in 7 days.