When running an action PowerShell run script block it is always passing and not returning the status code in case of exception.
The Script execution by the action PowerShell Run Script block rely on your script/script block to return the status code conditionally or in case of any exception. In case of no explicit exception is returned the PowerShell script exit with $LASTEXITCODE, which in case of Non-Terminating errors will be 0.
Release : 6.6
Component : CA RELEASE AUTOMATION RELEASE OPERATIONS CENTER
The example script on how the powershell script should handle returning conditional status code is as below.
$dest="c:\DirDoesNotExist"
$status
try{
cd $dest -ErrorAction Stop
}
catch [System.Exception]{
"Exception Occurred"
$status=1
}
finally{
exit $status
}
For more detail around PowerShell script refer PowerShell official documents