...
Within the order the value of the parameter Script_Filename, which specify the name of the script to be executed, will be passed to the job as an environment variable.
The script, which is executed in the above example, is as much as simple:
Code Block |
---|
$A="Hello, PowerShell ..."
$A
|
Code Block |
---|
Write-Host "Num Args:" $args.Length;
foreach ($arg in $args)
\{
Write-Host "Arg: $arg";
\}
|
Code Block |
---|
Write-Host "Environment-var Scheduler-Data is : $env:SCHEDULER_DATA"
Write-Host "Operating system is : $env:OS"
|
Code Block |
---|
exit $lastexitcode
|
Code Block |
---|
# to change the policy for using powershell you can use this .adm file:
# http://www.microsoft.com/download/en/confirmation.aspx?id=25119
|
The output in the log-file looks like the text below:
Code Block |
---|
C:\Program Files (x86)\scheduler>echo SCHEDULER_DATA = C:/Program Files (x86)/scheduler
SCHEDULER_DATA = C:/Program Files (x86)/scheduler
C:\Program Files (x86)\scheduler>echo SCHEDULER_PARAM_SCRIPT_FILENAME = C:/Program Files (x86)/scheduler\config\live\PowerShell\Powershell-Hallo.ps1
SCHEDULER_PARAM_SCRIPT_FILENAME = C:/Program Files (x86)/scheduler\config\live\PowerShell\Powershell-Hallo.ps1
C:\Program Files (x86)\scheduler>powershell get-ExecutionPolicy
SCHEDULER-918 state=release
RemoteSigned
C:\Program Files (x86)\scheduler>powershell -noprofile \
-file "C:/Program Files (x86)/scheduler\config\live\PowerShell\Powershell-Hallo.ps1" \
"C:/Program Files (x86)/scheduler\config\live\PowerShell\Powershell-Hallo.ps1"
Hello, PowerShell ...
Num Args: 1
Arg: C:/Program Files (x86)/scheduler\config\live\PowerShell\Powershell-Hallo.ps1
Environment-var Scheduler-Data is : C:/Program Files (x86)/scheduler
Operating system is : Windows_NT
C:\Program Files (x86)\scheduler>exit 0
|
see also: