Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

 

Code Block
linenumberstrue
<?xml version="1.0" encoding="ISO-8859-1"?>

<job  process_class="my_Agent" stop_on_error="no">
    <settings >
        <log_level ><![CDATA[debug1]]></log_level>
    </settings>

    <script  language="powershell">
        <![CDATA[
# Standard PowerShell verbose setting is considered for jobs:
$VerbosePreference = "continue"
Write-Verbose "job: this is some verbose output"

# Standard PowerShell debug setting is ignored for jobs:
# Instead the current log level of the job is applied, e.g. log level "debug1" logs debug messages
$DebugPreference = "continue"
Write-Debug "job: this is some debug output"

Write-Warning "job: this is a warning"

# This can be used to throw an error
# Write-Error "job: this is an error"

# This does not work: Use of Write-Host is not allowed
# Write-Host "job: this is some output"
        ]]>
    </script>

    <run_time />
</job>

 

Extras: PowerShell CLI for Powershell Jobs

The integration of the PowerShell CLI into PowerShell jobs is also available. A basic job using the PowerShell CLI might look like this:

Code Block
 <job process_class="my_process_classAgent">
 <script language="powershell">
 <![CDATA[

Import-Module JobScheduler
show-status

 ]]>
 </script>
<run_time />
Info
  • The feature is only available in case
you are running your Jobs on

 

...