Versions Compared

Key

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

...

Code Block
<?xml version="1.0" encoding="ISO-8859-1"?>
<job process_class="my_Agent">
    <script language="powershell">

echo "job is starting"

# pauses the job for 10 seconds
sleep 10

# show the files in a directory
$files = dir *
echo $files
echo "job is finishing"
    </script>
    <run_time />
</job>

...

Code Block
<?xml version="1.0" encoding="ISO-8859-1"?>
<job  process_class="my_Agent">
    <script  language="powershell">
	
	# PowerShell function used for the main job
	function get_files($directory){
		echo "entering function get_files"
		return get-childitem $directory
	}
	
	echo "job is starting"
	sleep 10
 
	# the same structure as in the example 1 but using a PowerShell function
	$files = get_files "my_directory"
	echo $files
	echo "job is finishing"
	
    </script>
    <run_time />
</job>

...

Code Block
<?xml version="1.0" encoding="ISO-8859-1"?>
<job process_class="my_Agent">
    <script language="powershell">
	
	function spooler_process()
	{
		$spooler_log.info(echo "job is starting")
		$files = get-childitem dir *
		echo $files 
		$spooler_log.info(echo "job is finishing")
		
		# for standalone jobs set to false / for order jobs set to true
		return $false
	}
    </script>
    <run_time />
</job>

...