...
- Parameter passing by environment variables is only available for PowerShell jobs that do not implement any of the API functions
spooler_init(), spooler_exit(), spooler_process()
etc.- Solution 1
$env:SCHEDULER_PARAM_NAME1
returns the respective parameter
- Solution 1
- A new object
$spooler_params
has been introduced- The objects includes parameters from both job and order. For parameters with the same name an order parameter beats a job parameter.
- The object includes the following methods:
- Solution 2
$spooler_params.get( "name1" )
reads a parameter value$spooler_params.value( "name1" )
is an alias for$spooler_params.get()
- Solution 3
$spooler_params.getAll()
returns a Variable_set with all job and order parameters.
- Solution 4
$parameters = $spooler_params.items
returns a PSObject that allows to access individual parameters as PowerShell properties$parameters.name1
returns the parameter"name1"
as property
- Solution 2
- The usual API methods for parameters access are available:
- Solution 5
$spooler_task.params().value( "name1" )
reads a job parameter
- Solution 6
$spooler_task.order().params().value( "name1" )
reads an order parameter
- Solution 5
...
- Parameters are return
- Solution 1
$spooler_params.set( "name1", "value2" )
- sets a job parameter if the current job is configured as a standalone job
- sets an order parameter if the current job is configured for a job chain.
- Solution 2
$spooler_task.params().set_value( "name1", "value2" )
sets a parameter for a job (for instance parametername1
with the initial valuevalue1
) and modifies the value tovalue2
- Solution 3
$spooler_task.order().params().set_value( "name1", "value2" )
sets a parameter for an order (for instance parametername1
with the initial valuevalue1
) and modifies the value tovalue2
- Solution 1
Anchor | ||||
---|---|---|---|---|
|
...
- If a native Windows program or script (.bat, .cmd) causes an error then this will assign the exit code to the
$LastExitCode
$Global:LastExitCode
global variable. This behavior does not apply to cmdlets causing errors. - JobScheduler checks this variable and will set the job exit code accordingly. For exit codes != 0 an error is raised.
- This behavior is superior compared to shell jobs as errors from any line in the job script are detected. For shell scripts only the last line of a job script determines the execution result (Unix:
$?
, Windows:%ERRORLEVEL%
).
...
- Users who wish to suppress exit codes of failed executions of native Windows programs or scripts can use
$LastExitCode $Global:LastExitCode = $null
- This will disable the above mentioned check of the last exit code.
...