Versions Compared

Key

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

...

Code Block
# Example Shell: 
echo name1 = value2 >> %SCHEDULER_RETURN_VALUES%

# Example PowerShell: 
$spooler_task.order().params().set_value("name1","value2")

Exit Code Handling

Example: let's consider a simple job such as:

Code Block
linenumberstrue
<?xml version="1.0" encoding="ISO-8859-1"?>
 
<job  process_class="/tests/Agent">
    <script  language="powershell">
 
	echo "job is starting"
	abcde
	echo "job is finishing"
 
    </script>
      <run_time />
</job>

 

This job throws no error in a Shell job but it breaks at line 2 and ends in an error for a PowerShell job with the following message: 

Code Block
[ERROR] Die Benennung "abcde" wurde nicht als Name eines Cmdlet, einer Funktion, einer Skriptdatei oder eines ausführbaren Programms erkannt. Überprüfen Sie die Schreibweise des Namens, oder ob der Pfad korrekt ist (sofern enthalten), und wiederholen Sie den Vorgang.

 

The same example would be ending with exit code 0 (no error thwron) for JobScheduler implementing it in the following way:

Code Block
linenumberstrue
<?xml version="1.0" encoding="ISO-8859-1"?>
 
<job  process_class="/tests/Agent">
    <script  language="powershell">
 
	echo "job is starting"
	try{abcde}
	catch{echo "exception line 7: abcde is either a cmdlet nor a variable"}
	echo "job is finishing"
 
    </script>
      <run_time />
</job>

 

 

Note

This type of differences described above will be further supported like this from JobScheduler and seen as natural differences between the Shell and PowerShell languages.