PowerShell script exit code not recognized¶
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 1withthrow "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.
Reference Ticket¶
33847
Reference Links¶
Discussed in the community
Looking for related questions…
Didn't find your answer? Ask the community about this page — questions are answered by Timextender experts, partners and other users.