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, Verify, 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.
Figure 6-29 Action - Run Script Dialog Box with the Specify a File on a Managed Device option selected
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:
No wait: The next action in the list is immediately performed.
When launch 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 wait period exceeded: 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.
Success Return Codes: Specify the non-zero success codes that the script returns. You can specify multiple success codes separated by commas.
If a script returns non-zero success codes, you should specify these non-zero success codes while launching the action. For example, explorer.exe in Windows returns a success code of 1. To successfully launch the Explorer application, you should add 1 as the success code while launching the action.
If you leave this field blank, zero will be considered as the success code. Specify the Success Return Code as * to enable any non-zero code returned by a script to be treated as success.
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.
Select this option to type a script in ZENworks Control Center.
Figure 6-30 Action - Run Script Dialog Box with the Define Your Own Script option selected
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.
Save File with 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 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:
No wait: The next action in the list is immediately performed.
When launch 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 wait period exceeded: 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.
Select this option to specify a script file that is already on the device on which you are running ZENworks Control Center.
Figure 6-31 Action - Run Script Dialog Box with the Select From This Device option selected
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:
No wait: The next action in the list is immediately performed.
When launch 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 wait period exceeded: 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.