YAML for Powershell Command

View as Markdown

Powershell Command (POWERSHELL)

YAML parameters for Powershell Command

PARAMETERS
targetsrequired(string | TargetYaml)[]
The list of target servers where the PowerShell commands will be executed. Each item is a target definition or a filter matching existing targets by identifier: a plain string such as sd* (* as a wildcard) or an object with type: MATCH.
commandsrequiredstring
Shell commands to execute on the remote server. Several commands go in one multi-line string (a | block), one per line - not a YAML list.
typerequiredstring

Value: POWERSHELL

actionrequiredstring
Unique identifier for the action within the pipeline.
run_as_scriptboolean
If set to true, commands will be executed as a PowerShell script
working_directorystring
Directory on the remote server where commands are executed.
execute_every_commandboolean
When true, execute all commands even if earlier ones fail.
trigger_timestring enum
Specifies when the action should be executed. ON_SUCCESS actions run after every successful run, also one ended by an EARLY_EXIT action.
Allowed enum:
ON_EVERY_EXECUTION,
ON_SUCCESS,
ON_FAILURE,
ON_BACK_TO_SUCCESS,
ON_WARNING,
ON_WAIT_FOR_APPROVE,
ON_TERMINATE
loopstring[]
Names of the variables to loop over (IMAGES, not $IMAGES and not a value). The action runs once for each item of the value, and once for each combination of items when several variables are listed. The variable value is split into items by new lines, or by commas when it has no new lines (a single-line JSON object or key=value pairs stays one item). An item that is a JSON object or key=value pairs also sets one variable per key, named <VARIABLE>_<key>; an item that starts with EXTRACT: sets them as plain <key>.
run_only_on_first_failureboolean
When true, the action runs only on the first failure instead of on each failure. Used only when trigger_time is ON_FAILURE.
disabledboolean
When set to true the action is disabled. By default it is set to false.
timeoutinteger
The timeout in seconds. It cannot exceed the action time limit of the workspace plan; a higher value is rejected.
ignore_errorsboolean
If set to true the execution will proceed, mark action as a warning and jump to the next action. Doesn't apply to deployment actions.
retry_intervalinteger
Delay time between auto retries in seconds.
retry_countinteger
Number of retries if the action fails.

Constraints: ≤ 10

run_nextstring enum
Defines whether the action should run in parallel with the next one.
Allowed enum:
WAIT_ON_SUCCESS,
IN_SOFT_PARALLEL,
IN_HARD_PARALLEL
trigger_conditionsTriggerConditionYaml[]
The list of trigger conditions to meet so that the action can be triggered.
variablesVariableYaml[]
The list of variables you can use in the action.

Last modified on Nov 19, 2026

YAML examples for Powershell Command

PowerShell deploy script with targets

yaml
- action: PowerShell deploy script
  type: POWERSHELL
  trigger_time: ON_EVERY_EXECUTION
  disabled: false
  working_directory: C:\app
  commands: |-
    Get-Process
    Write-Host 'Deploying application...'
    .\deploy.ps1
  execute_every_command: true
  run_as_script: true
  targets:
    - target: windows-prod
      type: SSH
      name: Windows Production Server
      host: windows-server.example.com
      port: "5986"
      auth:
        method: PASSWORD
        username: admin
        password: secret123
  ignore_errors: false
  retry_interval: 30
  retry_count: 2
  timeout: 3600

Simple PowerShell command

yaml
- action: PowerShell command
  type: POWERSHELL
  trigger_time: ON_EVERY_EXECUTION
  commands: "Get-Date"
  targets:
    - "my-ssh-target"

PowerShell with password authentication target

yaml
- action: "PowerShell deploy"
  type: "POWERSHELL"
  trigger_time: ON_EVERY_EXECUTION
  commands: "Get-Date"
  targets:
    - target: example
      type: SSH
      name: example
      host: 192.0.2.1
      port: "22"
      auth:
        method: PASSWORD
        username: deploy_user
        password: $MyPassword

PowerShell with SSH key authentication target

yaml
- action: "PowerShell deploy"
  type: "POWERSHELL"
  trigger_time: ON_EVERY_EXECUTION
  commands: "Get-Date"
  targets:
    - target: example
      type: SSH
      name: example
      host: 192.0.2.1
      auth:
        method: SSH_KEY
        username: deploy_user
        password: $MyPassword
        passphrase: $PassPhrase
        key: $Ssh_Key