Returning error code from PowerShell for Release Management


I have a PowerShell script that calls an exe and even if the exe fails Release Management shows the Status as Succeeded.


You must test $LastExitCode to determine if the exe succeeded or not.  If not you must throw an exception to report a failed status to Release Management.

if ($LastExitCode -ne 0) {
   throw "Command failed with exit code $LastExitCode."

Add comment