Batch and Script

Batch and Script is a powerful feature which allows you to easily dispatch the execution of local batches and scripts onto a single machine or a group of machines and receive a consolidated report of console outputs. The Batch and Script feature is accessible from any computer by expanding it and using the Batch and Script node, or, via the context sensitive menu.

This feature can be used to run batches (.bat), scripts (.vbs, .pl, etc...) and even binaries.

Defining Batch and Script

Before you can execute a batch or script on a remote machine, you must define it. To do so, right-click on the Batch and Script node of any computer and select Manage... to open the Run Batch Manager.

Batch Object Properties

  1. Enter the batch object's name and description.

  2. Run Path - Specify the full path of the batch or script for this object. The batch can be located on your machine or in a network share.

  3. Transfer Methods - Select The run path is accessible from the remote machines if the path specified points to a network share, or, Transfer the program to the following directory then run from local path to have Goverlan first transfer the batch program onto a temporary location on the target machines and then run it from there.

    If you select to transfer the batch first, you can modify the destination folder on the target machines. Note: The destination path may contain environment variables but they will be resolved using the System Variable set (not the User Variable Set).

    If the batch program has external dependencies, enable the Transfer the entire parent directory option. The dependencies must be located at the root of the parent folder.

    Enable
    Delete file(s) after execution if you wish to clean up the transferred files once the batch is completed.

  4. Execution - Select the credentials to use to execute the batch program. Note: If the batch is run directly from a network share, you cannot select Run As Local System since this account doesn't have network access.

    Enable Hide execution window to prevent the user interface from being displayed on the target machine during execution.

  5. Output - Configure the execution time out value and decide if you want Goverlan to kill the batch process if a time out occurs.

    If the batch program has reporting or error console output, enable the Record console output to option and configure an output text file path. The console output of the batch for all machines will be compiled into that output file. Goverlan automatically opens it at the end of the execution.

  6. Click on Apply.

Supported Run Paths

This feature supports batch programs, scripts and binaries. However, depending on the type of the object, the run path must be configured properly.

Configuring Batch Programs

A batch program (.bat) contains a series of command prompt instructions. It can process commands and calls outside batch programs or scripts.

Let's use an example. We have a dedicated directory called Batches which contains batches and scripts.

This directory contains visual basic scripts which outputs some information about the local machine and a Perl script which uploads local data files onto a server.
We need to execute both on target machines. We create a batch program called RunAll.bat with the following contents:

In effect, this batch program simply calls the other scripts using the appropriate interpreter.

Finally, we configure the Goverlan Batch program to run
\\madoco\GoverlanShared\Batches\RunAll.bat and configure the Transfer options to either:

Configuring Scripts

Running a script involves specifying a script interpreter in the run path. Since the script interpreter is already on the target machine, Goverlan only transfers the file that is pointed to by the script interpreter. When specifying a Run Path for a script, enter both the script interpreter and the script path in between single quotes.

For instance, the Run Path for the script  C:\Data\Scripts\vbs\helloWorld.vbs is:

CScript.exe 'C:\Data\Scripts\vbs\helloWorld.vbs'

Do not forget to specify the extension (.exe) of the script interpreter.

Then, select the appropriate transfer method. In this case, since the script is located locally, you would select Transfer the program ...

Configuring Binaries

You can also use this feature to remotely dispatch the execution of binary files. When doing so, remember that the binaries to be dispatched must only process tasks and terminate without a user interface prompt.

For example, you have a program C:\HotFixes\hfxQ42234A_Install.exe which installs a security update on the local machine and you wish to dispatch its execution to some of your machines.

Running Batch Objects

Once you have configured your batch objects, you can easily dispatch their execution on a single machine or a selection of multiple machines.