SwitchTender

PowerShell runs

A PowerShell run executes a script with pwsh, PowerShell 7. The script is the run's command. It suits Windows-leaning fleets and any task already written in PowerShell: service management, cloud module calls, or reporting.

What runs

The script is written to a temporary file and run with pwsh -NoProfile -NonInteractive -File, so multi-line scripts work unchanged and nothing prompts. The working directory is the project checkout when the run sources a project. A dry run parses the script into a script block without invoking it, so syntax is checked and nothing executes.

How values reach the script

  • Extra vars, including survey answers and template vars, arrive as SWITCHTENDER_VARS, a JSON object:

      $vars = $env:SWITCHTENDER_VARS | ConvertFrom-Json
      $region = if ($vars.region) { $vars.region } else { "us-east-1" }
    
  • Each var whose name a shell variable can hold and whose value is a string, a number, or a boolean also arrives on its own as SWITCHTENDER_VAR_<name>, which reads without parsing the JSON.

  • Credentials arrive in the environment. An env credential lands its KEY=VALUE lines directly, and a token credential arrives as SWITCHTENDER_TOKEN.

  • Anything the script prints that matches a materialized secret is masked to *** in the stored and streamed log, the same masking every tool gets.

Requirements

The pwsh binary must be on the PATH of the process executing runs, the server or a worker. On Linux and macOS that is PowerShell 7; on Windows it ships with PowerShell 7 installations. Nothing else is configured.

Example

$vars = $env:SWITCHTENDER_VARS | ConvertFrom-Json
Write-Output "deploying to $($vars.region)"
exit 0

Save it as a template with the PowerShell tool and a survey field region, and every launch prompts for the region and runs the script with it.

See also Bash runs, Python runs, and the features overview.