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"
:REGISTER_VARIABLE EXIT_CODE#, $LastExitCode
When I run this, I receive an error:
Syntax error in object 'JOBS...' line '00014'. 'U01001308 Variable 'EXIT_CODE#' has not yet been defined.