Versions Compared

Key

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

...

tbd

Code Block
collapsetrue
 

Example: Combination of both (Job with Monitors) 

tbd

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

<job  process_class="/tests/Agent">
    <script  language="powershell">


echo job is starting
sleep 10
echo job is finishing

    </script>
    <monitor  name="process_powershell" ordering="0">
        <script  language="powershell">
            <![CDATA[
		function spooler_process_before()
		{
		$env:files = get-childitem *
		echo $files
		$spooler_log.info("hallo")
		return $false
		}
            ]]>
        </script>
    </monitor>
    <run_time />
</job>

Example: PowerShell Job with Debug output

 

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


<job  process_class="Agent01" 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:
#   $DebugPreference = "continue"
# Instead the current log level of the job is applied, e.g. log level "debug1" logs debug messages
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: CLI for Powershell Jobs

Info

<job process_class="my_process_class">
<script language="powershell">
<![CDATA[

Import-Module JobScheduler
use-master myjobscheduler:4444
get-status


]]>
</script>

<run_time />
</job>tbd