Versions Compared

Key

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

...

Currently, neither COM Jobs nor Powershell Jobs are supported by JOE. So, Powershell Jobs need to be configured by editing XML files.To configure

configuring a powershell job

...

  • Have the <script> use the com_class JSPowershellAdapter.JobAdapter
  • define a parameter powershell_script which points to the location of the Powershell Job implementationjob implementation
    • If the path is relative, it needs to be relative to the SCHEDULER_DATA directory
  • write a powershell Job implementation which at least implements Function spooler_process()

Example job definition

Code Block
    <?xml version="1.0" encoding="ISO-8859-1"?>
  
    <job>
        <params>
            <param name="test" value="12345"/>
            <param name="powershell_script" value="powershell\powershell_job.ps1"/>
        </params>    
        <script com_class="JSPowershellAdapter.JobAdapter"/>
        <run_time once="no"/>
    </job>

Example Powershell Job

...

script

Code Block
    Function spooler_init()
    \{	
        if ($spooler_log)
        \{
            $spooler_log.info("This is spooler_init") 
            $spooler_log.info("TaskID: "+$spooler_task.id) 
        \}	
        
        return $true
    \}
  
    Function spooler_open()
    \{	
        $spooler_log.info("This is spooler_open") 
        return $true;
    \}
  
    Function spooler_process()
    \{	
        $spooler_log.info("This is spooler_process") 
        return $false;
    \}
  
    Function spooler_close()
    \{	
        $spooler_log.info("This is spooler_close") 
    \}
  
    Function spooler_exit()
    \{	
        $spooler_log.info("This is spooler_exit") 
    \}
  
    Function spooler_on_success()
    \{	
        $spooler_log.info("This is spooler_on_success") 
    \}
  
    Function spooler_on_error()
    \{	
        $spooler_log.info("This is spooler_on_error") 
    \}

configuring a powershell pre-/postprocessor

Only one powershell pre-/postprocessor can be configured per job.

  • Have the <monitor><script/></monitor> use the com_class JSPowershellAdapter.JobAdapter
  • define a parameter powershell_monitor_script which points to the location of the Powershell pre-/postprocessor implementation
    • If the path is relative, it needs to be relative to the SCHEDULER_DATA directory
  • write a powershell pre-/postprocessor implementation

Example job definition

Code Block

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

    <job>
        <params>		
            <param name="powershell_monitor_script" value="powershell\powershell_monitor.ps1"/>
        </params>
        <script language="javascript">
            <![CDATA[
    function spooler_process()\{
        spooler_log.info("this is javascript");
Code Block

        return false;
    \}
            ]]>
        </script>
        <monitor>    
            <script com_class="JSPowershellAdapter.JobAdapter"/>    
        </monitor>
    </job>

Example Powershell pre-/postprocessor script

Code Block

    Function spooler_task_before()
    \{
        $spooler_log.info("powershell: This is spooler_task_before")
        return $true
    \}
Code Block

    Function spooler_process_before()
    \{
        $spooler_log.info("powershell: This is spooler_process_before")
        return $true
    \}
Code Block

    Function spooler_process_after([bool] $spooler_process_result)
    \{
        $spooler_log.info("powershell: This is spooler_process_after with result $spooler_process_result")
        return $spooler_process_result
    \}
Code Block

    Function spooler_task_after()
    \{
        $spooler_log.info("powershell: This is spooler_task_after")
    \}