Fail deployment from powershell .exe

(s_yates1) #1

Hey All,

I have a step which runs a powershell script which in tern runs a .exe - The .exe will have an exit code of either 1 or 0 depending on success. How can I from that powershell script fail the deployment if the exit code of that .exe is not 0.

Thanks

Steve

(Peter May) #3

You could try this:

if ($exitCode -ne 0) {
   throw "Error. Exit code: $exitCode"
}
(Dalmiro Grañas) #4

Hi @s_yates1 ,

Peter’s approach should work for you. Please give it a try and let us know how it goes.

Thanks,
Dalmiro