Skip to content
Ask the community about this page

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 1 with throw "ErrorText"

Steps:

  1. Modify your PowerShell script to use throw "ErrorText" instead of exit 1.
  2. This will ensure that Timextender Orchestration recognizes the script as failed when an error occurs.

Reference Ticket

33847

Exmon DG 5.8

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.