Getting error in Octopus.Features.WindowsService_AfterPreDeploy.ps1 if only PowerShell version 2.0 installed

I am getting following error while deploying Windows service:

  • Octopus.Features.WindowsService_AfterPreDeploy.ps1’ returned non-zero exit code: 1

And I found that I am getting this error on computers with following PS version

Name                           Value
CLRVersion                     2.0.50727.5485
BuildVersion                   6.1.7601.17514
PSVersion                      2.0
WSManStackVersion              2.0
PSCompatibleVersions           {1.0, 2.0}
SerializationVersion           1.1.0.1
PSRemotingProtocolVersion      2.1

And it works fine on computers with following PS version:

Name                           Value
PSVersion                      4.0
WSManStackVersion              3.0
SerializationVersion           1.1.0.1
CLRVersion                     4.0.30319.18444
BuildVersion                   6.3.9600.16406
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0}
PSRemotingProtocolVersion      2.2

Here I found that Octopus requires PS 2.0, it doesn’t work
http://help.octopusdeploy.com/discussions/questions/2221-powershell-version

My Octopus version is 3.7.11.

Same issue with ver 3.8.2 (all tentacles updated)

Hi,

Thanks for reaching out! We’ll need a bit more info than that generic error message. Could you please send us the full deployment log instead?

http://docs.octopusdeploy.com/display/OD/Get+the+raw+output+from+a+task

Thanks,
Dalmiro