...
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- (or job-) parameters has to specify the name of the script and some more parameters, which will be accessed then by the PowerShell script.
Code Block |
---|
<[http://www.sos-berlin.com/doc/en/scheduler.doc/xml/job.xml job ]<job title="Execute a PowerShell Script" order="yes" stop_on_error="no"> <[http://www.sos-berlin.com/doc/en/scheduler.doc/xml/script.xml script ]<script language="shell"> <![CDATA[<i><b> powershell -nologo -NonInteractive -noprofile -file "%SCHEDULER_PARAM_SCRIPT_FILENAME%" exit %errorlevel% </b></i> ]]> </script> <[http://www.sos-berlin.com/doc/en/scheduler.doc/xml/monitor.xml monitor ]<monitor name="configuration_monitor" ordering="0"> <[http://www.sos-berlin.com/doc/en/scheduler.doc/xml/script.xml script ]<script java_class="[http://www.sos-berlin.com/doc/doxygen-docs/SOSScheduler/html/classsos_1_1scheduler_1_1managed_1_1configuration_1_1_configuration_order_monitor.html sos.scheduler.managed.configuration.ConfigurationOrderMonitor]" language="java"/> </monitor> <[http://www.sos-berlin.com/doc/en/scheduler.doc/xml/run_time.xml run_time]<run_time/> </job> |
The <monitor> used in this example is needed for parameter substitution of the order-parameters.
...
- How to execute a PowerShell script with JS
- Setting the executionPolicy to execute .ps1-scripts
- How to get the Exit code Code of a powershell scriptPowerShell Script
- How to pass variable-values from JS to a powershell script
...