Run#

Runs a specified executable or file.

Required Parameters#


Paramater

Description

Type

exe

Specifies the executable filename, and can optionally include the full path.

string

Optional Parameters#


Paramater

Description

Type

Default

path

Specifies the directory for the specified executable.

string

None

args

Specifies the command-line arguments for the process.

string

None

baseDir

Creates the process with the amelioration directory as its working directory.

bool

false

exeDir

Creates the process with the Playbook executables folder as its working directory.

bool

false

runas

Specifies what user the process should be run as.

Enum:
currentUser
currentUserElevated
system
trustedInstaller

trustedInstaller

timeout

Specifies a timeout for the process, where it will kill the process and report an error if the timeout is reached.

integer

None

wait

Specifies whether or not to wait for the process to exit.

bool

true

handleExitCodes

Allows control over how specified exit codes should be handled.

Handlers can be specified like so: handleExitCodes: {1: log, 2: error, 3: halt, -1: retry}

Any of the following handlers can be used:
log - create a log entry
error - throw an error
halt - halt the Playbook
retry - re-run the action up to 5 times
retryError - re-run the action up to 5 times and throw an error if the exit code never changes

You can also use conditional expressions like in the following example: handleExitCodes: {'!0': log, '>=1': show}.

dictionary

None

showOutput

Specifies whether or not to forward the StandardOutput of the executed process to the output log.

bool

true

showError

Specifies whether or not to forward the StandardError of the executed process to the output log.

bool

true

Examples#

- !run:
  exe: 'DISM'
  args: '/Online /Disable-Feature /FeatureName:"SmbDirect" /NoRestart'
  weight: 30
- !run: {exe: 'EXAMPLE.bat', exeDir: true}
- !run: {exe: 'winget', args: "install M2Team.NanaZip", runas: currentUserElevated}