Versions Compared

Key

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

...

Code Block
languagepowershell
titlePowerShell Job with API methods
collapsetrue
<?xml version="1.0" encoding="ISO-8859-1"?>
<job  process_class="/tests/Agent" stop_on_error="no">
    <script  language="powershell">
        <![CDATA[
function spooler_process()
{		
	# set variables to store the information about job and task 	
	$jobName = $spooler_job.name()
	$jobTitle = $spooler_job.title()
	$taskId = $spooler_task.id()
	
	# display the information about job and task
	echo "job $jobName with title $jobTitle is starting"
	echo "task ID is $taskId"
		
	echo "job is finishing"
		
	# for standalone jobs set return code to false / for order jobs set to true in case of successful execution
	return $false
}
        ]]>
    </script>
    <run_time />
</job>

 

Example: Combine both PowerShell Job and Monitor

This PowerShell sample job implements a  pre-processing Monitor script that is executed before the job script is executed:

...

Example: PowerShell Job with different output channels

The following sample job explains how to use output channels for PowerShell such as:

...