Run a Script

Octopus.Script exported 2026-07-22 by Octopus Deploy belongs to ‘Script’ category.

Runs a PowerShell, Bash, C#, or Python script.

Parameters

When this step is included in a project’s deployment process, the parameters below can be set.

Script source

Octopus.Action.Script.ScriptSource (required)

The source of the script to run. Can be inline, from a package, or from a Git repository.

Allowed values: Inline, Package, GitRepository

Default: Inline

Script syntax

Octopus.Action.Script.Syntax

The syntax of the script being run in a script step. Required when the script source is Inline.

Allowed values: PowerShell, CSharp, Bash, FSharp, Python

Default: PowerShell

Example: PowerShell

Script body

Octopus.Action.Script.ScriptBody

The inline script body to execute.

Example: Write-Host 'Hello!'

Script file name

Octopus.Action.Script.ScriptFileName

The path to the script file to execute when the source is a package or Git repository.

Example: Scripts/MyScript.sh

Script parameters

Octopus.Action.Script.ScriptParameters

Parameters to pass to the script file.

Run on server

Octopus.Action.RunOnServer

Whether or not the action runs on the Octopus Server.

Allowed values: True, False

Default: False

Example: True

Optional features

Enable features by adding their IDs to Octopus.Action.EnabledFeatures (a comma-separated list).

.NET Configuration Transforms Octopus.Features.ConfigurationTransforms

Runs configuration file transforms. Enabled by default for package deployments.

Octopus.Action.Package.AutomaticallyRunConfigurationTransformationFiles

Octopus.Action.Package.AutomaticallyRunConfigurationTransformationFiles

Run default XML transforms (True/False).

Octopus.Action.Package.AdditionalXmlConfigurationTransforms

Octopus.Action.Package.AdditionalXmlConfigurationTransforms

Comma- or newline-separated list of additional transform rules (e.g. Web.Release.config => Web.config).

.NET Configuration Variables Octopus.Features.ConfigurationVariables

Replace appSettings and connectionStrings in .config files. Enabled by default for package deployments.

Octopus.Action.Package.AutomaticallyUpdateAppSettingsAndConnectionStrings

Octopus.Action.Package.AutomaticallyUpdateAppSettingsAndConnectionStrings

Replace appSettings and connectionStrings in .config files (True/False).

Structured Configuration Variables Octopus.Features.JsonConfigurationVariables

Replace settings in JSON, YAML, XML, and Java Properties files with Octopus variables. Enabled by default for package deployments.

Octopus.Action.Package.JsonConfigurationVariablesTargets

Octopus.Action.Package.JsonConfigurationVariablesTargets

Newline-separated list of target files (e.g. appsettings.json). Wildcards supported.

Substitute Variables in Templates Octopus.Features.SubstituteInFiles

Transforms files using the Octopus #{Variable} substitution syntax. Enabled by default for package deployments.

Octopus.Action.SubstituteInFiles.TargetFiles

Octopus.Action.SubstituteInFiles.TargetFiles

Newline-separated list of file names to transform (relative to package). Wildcards supported.

Octopus.Action.SubstituteInFiles.OutputEncoding

Octopus.Action.SubstituteInFiles.OutputEncoding

Encoding name for the output file (e.g. utf-8). Optional.

PowerShell Edition Octopus.Features.SelectPowerShellEditionForWindows

Specify the edition of PowerShell used during deployments on Windows.

Octopus.Action.PowerShell.Edition

Octopus.Action.PowerShell.Edition

PowerShell edition on Windows (Desktop or Core).

Allowed values: Desktop, Core

Step configuration using OCL

Example in Octopus Configuration Language (OCL):

step "run-a-script" {
    name = "Run a Script"
    properties = {
        Octopus.Action.TargetRoles = "web-server"
    }

    action {
        action_type = "Octopus.Script"
        properties = {
            Octopus.Action.RunOnServer = "False"
            Octopus.Action.Script.ScriptBody = "Write-Host 'Hello from Octopus'"
            Octopus.Action.Script.ScriptSource = "Inline"
            Octopus.Action.Script.Syntax = "PowerShell"
        }
    }
}

Page updated on Wednesday, July 22, 2026