PowerShell scripts should be started with -NonInteractive

Title is pretty self-explanatory. If you create a script step that does something like this:

New-Item C:\Foo\Bar;

… and then run the deployment, the step will hang forever until a time-out occurs (which takes 5 minutes), upon which Octopus will kill the step and say ‘The remote script failed with exit code -1’ and ‘The operation was canceled.’.

The reason for this is of course that when you execute the above script, which is missing a required parameter, PowerShell will helpfully ask you to supplement parameters to New-Item with an interactive prompt.

Hi Erik,

Thanks for getting in touch! We typically do bootstrap PowerShell scripts with the -NonInteractive argument for this very purpose. Thanks to your report I’ve found that Calamari wasn’t specifying the -NonInteractive argument when executing PowerShell script steps.

I’ve created a GitHub issue for you to track the progress of this fix: https://github.com/OctopusDeploy/Issues/issues/1924

Hope that helps.