Missing statement block after 'else' keyword

We receive the below error when trying to deploy a windows service. Any solution for this?

Missing statement block after 'else' keyword.
Error    20:43:29
At C:\inetpub\.SQ-AMS-PLUTO20-683B750C\Octopus.Tentacle\\Scripts\Octop
Error    20:43:29
us.Features.WindowsService_BeforePostDeploy.ps1:127 char:6
Error    20:43:29
+ else  <<<< if ($status -eq "Disabled")
Error    20:43:29
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordEx 
Error    20:43:29
Error    20:43:29
    + FullyQualifiedErrorId : MissingStatementBlockAfterElse
Fatal    20:43:29
PowerShell script returned a non-zero exit code: 1
Tentacle version

Hi Michiel,

Thanks for getting in touch!
Yeah that is a nice bug you have discovered, sorry about that.
I have created an issue in GitHub that you can track here: https://github.com/OctopusDeploy/Issues/issues/1031
We will endeavor to get this fixed asap, and let you know when the download is available.


Perfect. Thanks!

Until they post a new release, as a work around on each tentacle you can edit the script in the error: Octopus.Features.WindowsService_BeforePostDeploy.ps1

Towards the bottom there are two places that say: else if (…
They should say: elseif (…

Easy mistake when context switching between c# and powershell.

Hi Michiel and Adam,

The fix for this is now live and available as a download:

Thanks for your patience and reporting this issue.


Thanks for the quick fix!