Powershell Script Error

My Powershell Script step completed it’s run but is showing the below error at the end of it’s run. I suspect it’s due to the call to linkd.exe. The reason I say this is because the script call linkd.exe multiple time but for some reason it keeps failing (as it not returning a result) on 2nd/3rd time it’s called. I have tried calling linkd.exe twice in script console and have no issue. Any idea on what the issue is or how to investigate the issue.

The remote script failed with exit code 322
March 1st 2017 07:36:34Verbose
at Octopus.Worker.Scripting.ScriptResult.EnsureSuccessful() in Z:\buildAgent\workDir\eec88466c176b607\source\Octopus.Worker\Scripting\ScriptResult.cs:line 81
at Octopus.Server.Orchestration.Deploy.Guidance.Execute(Action callback) in Z:\buildAgent\workDir\eec88466c176b607\source\Octopus.Server\Orchestration\Deploy\Guidance.cs:line 61
at Octopus.Server.Orchestration.Deploy.DeploymentTaskController.ExecuteWithTransientErrorDetection(Action action, Machine machine) in Z:\buildAgent\workDir\eec88466c176b607\source\Octopus.Server\Orchestration\Deploy\DeploymentTaskController.cs:line 424
at Octopus.Server.Orchestration.Deploy.DeploymentTaskController.ExecuteActionAndInitLoggingContext(PlannedStep step, Machine machine, PlannedAction action) in Z:\buildAgent\workDir\eec88466c176b607\source\Octopus.Server\Orchestration\Deploy\DeploymentTaskController.cs:line 322
March 1st 2017 07:36:34Fatal

Hi Binh,

Thanks for getting in touch! It’s probable linkd.exe is returning that error code. Try putting a exit 0 at the end of your script.

If that does not work, please send us a copy of the script.

Hope that helps!

Robert W