The Action - Run Script dialog box lets you configure a script to be executed on the managed device. For the Run Script action to successfully complete, ensure that the script is silent (requires no user intervention). You can also specify the specific requirements that a device must meet for the action to be executed on the device.
To access this dialog box in ZENworks Control Center, click the Bundles tab. Click the underlined link of a bundle in the Name column of the Bundles list, click the Actions tab, click one of the action set tabs (Distribute, Install, Launch, Repair, Uninstall, Terminate, or Preboot), click the Add drop-down list, then select an available action.
The following sections contains additional information:
The General page lets you configure a script to be executed on the managed device. For the Run Script action to successfully complete, ensure that the script is silent (requires no user intervention).
The settings vary, depending on the type of script you select from the Script to run list. The following options are available:
Select this option to run a script that exists on the managed device.
Script Filename: Specify the path to the script file on the target device, for example, C:\scripts\xyz.pl.
Script Parameters: Specify any additional parameters you want to place on the command line after the script filename is specified. This results in parameters being passed to your executable script.
Path to Script Engine: Specify the interpreter that launches to run your script. For example, C:\Program Files\Perl\bin\Perl.exe.
For Windows scripts other than batch scripts (for example, VBScript), the Path to Script Engine field should specify the path to the Windows Based Script Host, such as (C:\Windows\System32\wscript.exe)
Script Engine Parameters: Specify any parameters you want included on the command line when the script engine launches.
Wait Before Proceeding to Next Action: Specify what happens after the script is run:
Do not wait: The next action in the list is immediately performed.
Proceed when an action is complete: The next action in the list is performed after the launch action completes.
Wait for _ seconds: Wait the specified number of seconds before proceeding to the next action.
Terminate action if it has exceeded its wait duration: If you select the Wait for _ seconds option, this option is enabled. If the specified number of seconds is exceeded and the action is not successfully performed, the action is terminated.
Select this option to type a script in ZENworks Control Center.
Script Content: Click Edit to display a text box where you type your script. This script is delivered to the assigned devices and is executed in the standard device shell environment.
For example, you can automate drive mapping using the script capabilities of bundles. Your bundle’s script could read:
net use m: \\server\sys
net use w: \\server\vol1
If the user is logged in as an eDirectory user with rights, then the mapping works. They can map a drive to a Windows share using a domain account by putting the username / password on the script line. If they are a logged in as an Active Directory user and have rights, the username / password is not required. If an Environment Variable is specified, then ZENworks will resolve that variable with the associated value. For example, if %USERNAME% is provided as the Environment Variable, then the variable will be resolved to the value of the logged-in user.
However, if you do not want the variable to be resolved and want it to be displayed as is, then you need to add additional percent signs before and after the variable. For example, if you want the output to be displayed as %USERNAME%, specify %%USERNAME%% or if you want the output to be displayed as %%USERNAME%%, specify %%%USERNAME%%%.
Script File Extension: Specify the extension that you want appended to the script when it is saved. For example, .bat.
Path to Script Engine: Specify the interpreter that will run your script.
Script Engine Parameters: Specify any parameters you want included on the command line when the script engine launches. .
Wait Before Proceeding to Next Action: Specify what happens after the script is run:
Do not wait: The next action in the list is immediately performed.
Proceed when an action is complete: The next action in the list is performed after the launch action completes.
Wait for _ seconds: Wait the specified number of seconds before proceeding to the next action.
Terminate action if it exceeds its wait duration: If you select the Wait for _ seconds option, this option is enabled. If the specified number of seconds is exceeded and the action is not successfully performed, the action is terminated.
Select this option to specify a script file that is already on the device on which you are running ZENworks Control Center.
Select From This Device: Browse to and select the script file.
Script Parameters: Specify any additional parameters you want to place on the command line after the script filename is specified. This results in parameters being passed to your executable script.
Path to Script Engine: Specify the interpreter that launches to run your script.
Script Engine Parameters: Specify any parameters you want included on the command line when the script engine launches.
Wait Before Proceeding to Next Action: Specify what happens after the script is run:
Do not wait: The next action in the list is immediately performed.
Proceed when an action is complete: The next action in the list is performed after the launch action completes.
Wait for _ seconds: Wait the specified number of seconds before proceeding to the next action.
Terminate action if it has exceeded its wait duration: If you select the Wait for _ seconds option, this option is enabled. If the specified number of seconds is exceeded and the action is not successfully performed, the action is terminated.
Working Directory: Click More Options to specify the script’s working directory. Specify the initial working directory for the script.
Priority: Click More Options to specify the script’s priority. Specify the priority of the process that runs the script. This option lets you configure how much of the CPU usage the script process consumes. Select from the following priorities: Real Time, High, Above Normal, Normal, Below Normal, and Low.
Run As: Click More Options to specify the script’s run as setting. Specify an option:
System: Runs the script as the system account (as a service).
Administrator: Runs the script as a dynamic administrator user. A dynamic administrator is an administrator account that is created on the fly to perform certain procedures, such as installing applications or running scripts. Using a dynamic administrator is helpful when installing applications (some MSI applications, for example) that cannot be installed in the system space. When you select this action, the dynamic administrator is created, it performs the required tasks, and then the account is deleted.
User: The script runs, using the logged-in user’s credentials. For example, the script has the same rights to the registry and the file system as the logged-in user.
The following options are available for Linux:
Root: The script runs by using the credentials of the root user.
User: The script runs by using the logged-in user’s credentials. For example, the script has the same rights to the registry and the file system as the logged-in user.
The Requirements page lets you define specific requirements that a device must meet for the action to be enforced on it. For information about the requirements, see Requirements.