Symptoms
Error while executing a PowerShell script via TimeXtender Orchestration. The script does not recognize exit codes correctly, leading to incorrect execution status.
Error: PowerShell script exit code not recognized.
Cause
The issue arises because TimeXtender Orchestration does not correctly interpret exit codes (exit 0
for success and exit 1
for failure) in PowerShell scripts.
Resolution
To ensure that the PowerShell script fails correctly, use the following syntax to trigger a failure:
- Replace
exit 1
withthrow "ErrorText"
Steps:
- Modify your PowerShell script to use
throw "ErrorText"
instead ofexit 1
. - This will ensure that TimeXtender Orchestration recognizes the script as failed when an error occurs.