Skip to main content
Barracuda MSP Partner Toolkit

How to Call Files to Execute Using Scripts

Beginning with Managed Workplace 2011, scripts are no longer stored in a static location. Instead, a folder for each script is created in the Windows temporary folder, and is automatically deleted when the script executes.

When the execution files require switches, for example when using /silent to execute without user interaction, it is best to develop the script using the Managed Workplace parameters options. However, if you have constraints that do not permit you to use the parameters options, you can still build the arguments into a batch file or vb script. Doing so requires that you include added instructions to provide access to the files being executed from the temporary location.

Below are examples of batch files or vb scripts which include added instructions allowing access to the files being executed from the temporary location. 

Example of a .bat file

The .zip file contains two files, start.bat and installer.exe. In order to successfully launch the installer, switches are required to perform the install: installer.exe /quiet /reboot. The start.bat is the file to execute and in legacy versions of Managed Workplace, it would have contained path information for the LPIscripts directory and then the executable with arguments.

In the current version the instructions for the batch file would be this:
cd /d %~dp0 installer.exe /quiet /reboot

The first line of the batch file will associate the path to the directory that is created within the Windows temp folder and allow the file to execute.

If there are spaces in the executable name, then this would be used:
cd /d %~dp0 “the installer.exe” /quiet /reboot

Example for a VB Script

Include the following line in a VB Script to associate the path for the working directory:

dir = left(WScript.ScriptFullName,(Len(WScript.ScriptFullName))-(len(WScript.ScriptName)))