You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 17 Next »

PowerShell as a job

Accessing parameters, coming from an order or a job, by environment variables makes it easy to use a generic job for executing PowerShell scripts. The order parameters or job parameters have to specify the name of the script and some more parameters that will be passed to the PowerShell script.

 <job title="Execute a PowerShell Script"      order="yes"      stop_on_error="no">
    <script language="shell">
        <![CDATA[
  powershell -nologo -NonInteractive -noprofile -file "%SCHEDULER_PARAM_SCRIPT_FILENAME%" 
  exit %errorlevel%
        ]]>
    </script>
    <monitor name="configuration_monitor" ordering="0">
        <script java_class="sos.scheduler.managed.configuration.ConfigurationOrderMonitor" language="java"/>
    </monitor>
    <run_time/>
 </job>

The <monitor> used in this example is required for parameter substitution of the order parameters.

Related Downloads

See also

  • No labels