Skip to main content

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

Reference Links

Exmon DG 5.8

I have replaced all the “exit 1” to a throw message. The problem is that the Write-Output that happened before the throw is not being shown anymore, so there is no debugging information from the time the error happened, only the throw message. How can we use throw AND having all the debug information available?


Reply