Not able to run powershell scripts

I’m trying to run a PostDeploy.ps1 powershell script, but I seem unable to run any. Even the most simple scripts fail with:

Working dir: c:\Octopus\Applications\Test\My.Database\
Running script…
ERROR: Missing expression after unary operator ‘-’.
ERROR: At line:1 char:2
ERROR: + -E <<<< xecutionPolicy Unrestricted -File c:\Octopus\Applications\Test
ERROR: .Database\\

PowerShell exit code: 0

If I run the script manually, they succeed. So it seems to be something wrong with the server configuration.

I added a different machine and it works on that machine, so it’s definitely a server configuration issue. Any ideas? Maybe powershell version?

Hi Jonne,

Is it possible that the server the script fails on is running PowerShell


Paul Stovell
Octopus Deploy
W: | T: @octopusdeploy

Hi Paul,

It was indeed running PowerShell 1.0. I’ve upgraded it to 2.0 and now it works. Thanks!