In some cases, users may wish to force a PowerShell Job to exit at a specific point and add a custom exit code. In order to do this you can use the following variable in your PowerShell Source:
$Host.SetShouldExit(411)
In this example, 411 is the custom exit code that is being specified and can be set to a users specific needs. This custom exit code can then be added to the Source Options tab in the Job properties. In our example above, the exit code of 411 signifies an Informational exit code value for the Job.
It'd be nice if JAMS could port the system $LASTEXITCODE to the JAMS exit code so you wouldn't have to add this to your scripts.
Hi Chris, if you're interested in submitting a JAMS enhancement request, you can do so here.
https://support.jamsscheduler.com/hc/en-us/requests/new?ticket_form_id=360000558451