AnsweredAssumed Answered

PowerShell Exit Code

Question asked by BrandonHumphrey611074 on Sep 17, 2018
Latest reply on Sep 26, 2018 by BrandonHumphrey611074

I'm attempting to retrieve an exit code from a PowerShell function and then exit with that code from an Automic JOB. I've confirmed that the function does exit with the appropriate exit code, it's just not getting back out to the JOB. Here's an example of the 'Process' tab on the JOB.


Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope Process -Confirm:$false -Force

Import-Module -Name "\\networkShare\customModule.psm1"

$VerbosePreference = "Continue"

Custom-Function -Verbose





When I run this, I receive an error:

Syntax error in object 'JOBS...' line '00014'. 'U01001308 Variable 'EXIT_CODE#' has not yet been defined.