Octopus Deploy 3.4.13

Hi,

From the Octopus Deploy website under Tasks > Script Console, which have used before to deploy one shot maintenance to environments, however, this seemingly harmless script is not outputting the environment variable value for a specific targetted end point

$environment = $OctopusParameters['Octopus.Environment.Name']
Write-Host "Environment: $environment"

End result is the output is blank, was rather expecting the name of the environment for that targetted endpoint.

Am I missing something?

Thanks,

Hi Tommie,

Did this used to work for you when running the script through the Script Console?

As far as I can remember we’ve never populated this field as a script run through the Script Console doesn’t run in the context of an environment like a deployment of a release does.

Thank you and best regards,
Henrik

Hi Henrik,

Many thanks for the response.

Yes, I do recall being able to execute one shot scripts that referenced the variable through the Script Console.

Thanks and best regards