Custom powershell script not saving variable

I am having a problem with the Custom deployment scripts section. I am wanting to create a post deployment script so have a couple of steps doing a Copy-Item (it’s with powershell) then on a new line I want to run an .exe with a few commands. This all works within powershell but the variable is getting chucked off when saving. So the below is what I want to type:

C:\Octopus\Applications\DevelopmentIntegration\Deployment.Console$OctopusParameters[‘Octopus.Action[Deployment Package].Package.NuGetPackageId’]\KssDeploymentTool.exe -up-ps -con-ps $ConnectionStringPS

But when I click save, it goes to just:

C:\Octopus\Applications\DevelopmentIntegration\Deployment.Console$OctopusParameters[‘Octopus.Action[Deployment Package].Package.NuGetPackageId’]\KssDeploymentTool.exe -up-ps -con-ps

Can someone please tell me why the last bit is being removed?? The -up-ps is a typical valid powershell option for a module (or .exe in this situation)…


Thanks for getting in touch. We have a bug submitted for this one:

The bug happens if the last thing you do is adding a variable from the list. So to make this work you can:

  1. Add some code to your step:
  1. Add a variable using the list. Your code should look like this now:
write-output $MyVariable
  1. Add an extra character at the end of your code, like a “.”(dot) :
write-output $MyVariable.
  1. Delete the dot and save the step