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\1.0.1.32810_4
Variables:
Running script…
ERROR: Missing expression after unary operator ‘-’.
ERROR: At line:1 char:2
ERROR: + -E <<<< xecutionPolicy Unrestricted -File c:\Octopus\Applications\Test
My
ERROR: .Database\1.0.1.32810_4\Bootstrap.360e07e8-a7dc-4cea-a68a-8d1a792b06df.ps
1

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
1.0?

Regards,

Paul Stovell
Octopus Deploy
W: octopusdeploy.com | T: @octopusdeploy http://twitter.com/octopusdeploy

Hi Paul,

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