You can add your own scripts to Barracuda Managed Workplace, which is recommended for users who have some scripting knowledge. When adding your own scripts, keep the following in mind:
- Barracuda Managed Workplace supports scripts for Windows, Mac OS, and Unix/Linux devices.
- Scripts can also be executables.
- You must install a command interpreter on the device if it is not native.
- If you're using PowerShell, it must be enabled on the device.
- When creating a task using a PowerShell script, there is an option to enable PowerShell on the target device if it is not already enabled.
Recognized Script Languages
Barracuda Managed Workplace recognizes the following script languages:
Mac OS X
Executable (no extension or .exe)
Shell (.sh, .csh, .bash, ksh)
Scripting Best Practices and Notes
When adding your own scripts, keep the following in mind:
- Barracuda Managed Workplace allows a script to be created with the same name as an existing script. This is because internally, Barracuda Managed Workplace uses a GUID (Globally Unique Identifier). This GUID is automatically generated for each script, is unique when created, and will not be duplicated (and it is not visible in the user interface).
- Maximum script file size: For hosted Service Center environments, 1GB for all scripts and parameters. For on premise Service Center deployments, 1 GB per script or parameter.
- Maximum number of simultaneous scripts running: 5 and after that the scripts queue.
- Scripts are never deleted automatically by Service Center.
- Many Barracuda Managed Workplace scripts change settings that are also configurable using group policy. Ensure no competing policy exists when using these scripts, otherwise options you have set may be changed back when the policy is applied at next boot.
- When writing a script and you want to call another script that is bundled with the package, you have to provide a full path name.
To determine the full path name from within PowerShell, use the following command:
$myDir = Split-Path -Parent
To determine the full path name from within VBscript, use the following command:
dir = left(WScript.ScriptFullName,(Len(WScript.ScriptFul lName))-(len(WScript.ScriptName)))
To determine the full path name from within Python, use the following command:
scriptPath = os.path.dirname(os.path.abspath(inspect.getfile(in spect.currentframe())))
To determine the full path name from within a .BAT script, use the following command:
- Automated Tasks on Windows run as the Local System account on the target machine, which means that scripts must be silent. The logged in user won't see any windows opened by the script, and won't be able to interact with the script, for example, by clicking or pressing buttons.
- Scripts should not reference the HKEY_CURRENT_USER registry key, since HKEY_CURRENT_USER would be the registry hive for Local System, which is not likely the intended target account.
- Scripts won't be able to access network folders.
Scripting Configuration Options
When adding your own scripts to Barracuda Managed Workplace, there are several options you can select that determine how the script is run.
Run on Onsite Manager
Scripts can be configured to run on Onsite Manager. Running a script on Onsite Manager causes the execution to occur on the Onsite Manager device, targeting the devices specified.
Typically this option is used in conjunction with script variables that resolve to values corresponding to the targeted devices. See Variables.
You can set if you want a script to run without any other dedicated execution scripts running at the same time. For example, if you're installing software, you would only want that script to run before another one starts.
You can specify that a script will run on any platform, or on specific platforms. Supported platforms include Windows, Mac OS, and Linux/Unix. It is recommended that you select the "any platform" option when creating a script to run on Onsite Manager, as the task will be targeting multiple devices.
You can specify that a script will run on any platform, or on specific platforms. Supported platforms include Windows, Mac OS, and Linux/Unix. It is recommended that you select the “any platform” option when creating a script to run on Onsite Manager, as the task will be targeting multiple devices.
About Script Parameters
Scripts can have any number of parameters associated with them. Parameters must be filled in if they are required, whether or not there is a default value. If there is a default value and you remove it, you cannot save the script.
There are two ways that parameters can be passed. The first is using key-value pairs, as explained below. You can also pass parameters by entering a command as if you were using a command line, or specify that the script has no parameters.
Key/Value Parameters are passed to scripts as key-value pairs in the form <key>=<value>. The keys for each parameter on the Script Details page must match the keys expected by the scripts. It is possible to use scripts that do not accept key-value pairs as defined above. The values for these parameters will simply be passed to the script at run-time.
The parameters are listed in the order displayed in the user interface. You can move parameters up and down in the list when setting up your script.
Optional Parameters Parameters can be tagged as optional. If a parameter is optional and the user does not specify a value when creating a task, the parameter is not passed to the script.
Variables Parameters accept Windows environment variables and Barracuda Managed Workplace-specific variables.
|Barracuda Managed Workplace-specific variables||Description|
|%CUSTGUID%||The customer GUID.|
|%DeviceDNSName%||The DNS name of the target device.|
|%DeviceGUID%||The device's GUID.|
|%DeviceIP%||The IP address of the target device.|
The MAC address of the target device.
The host name of the target device.
|%SCMessagingURL%||The SC Messaging URL.|
|%SCURL%||The Service Center URL.|
|%VARNAME%||The VAR name.|
Label The label supplied when creating a script is displayed to the user as a form label when they add a task.
Types Parameters can be:
- an integer, which can have a minimum and maximum value specified and a default value.
- a string, which can have a maximum length specified and a default value.
- a file, which will enable the user to click a Browse button to locate a file on their system and have the file uploaded and included in the task sent to devices. This can be used for software installation, for example.
a flag, which is passed as an integer, with the value 1 for true and 0 for false. The script will act based on the presence of this parameter. For example, a script might install software silently if the Silent flag is present. This is represented in Barracuda Managed Workplace as a check box. Flags cannot be optional because they are always true or false.
- a list, which enables the user to select from a number of string values using a drop list.
- a password, in which the value will be masked on entry and on display. The value is stored in a two-way encrypted format in the database, but they are passed to scripts in clear text.
Default Parameters, except for file and password parameters, can have a default value. These are populated in value boxes in tasks when they are first added but can be changed at a later time.