It seems like your browser didn't download the required fonts. Please revise your security settings and try again.
Barracuda RMM
formerly Managed Workplace

About Adding Scripts

  • Last updated on

You can add your own scripts to Barracuda RMM, which is recommended for users who have some scripting knowledge. When adding your own scripts, keep the following in mind:

  • Barracuda RMM supports scripts for Windows, macOS, 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.

For information on where files are stored, see Where Automation Files are Stored in Automation Requirements

This topic includes the following:

Recognized Script Languages

Barracuda RMM recognizes the following script languages:

Language

Windows

macOS

Unix/Linux

Executable (no extension or .exe)

Yes

Yes

Yes

PowerShell (.ps1)
(Version 5.1 and lower)

Yes

No

No

PowerShell (.ps1)
(Version 6.0 and higher)

YesYesYes

VBScript (.vbs)

Yes

No

No

Perl (.pl)

YesYesYes

Batch (.bat)

YesNoNo

JavaScript (.js)

YesYesYes

Command (.cmd)

YesNoNo

Python (.py)

YesYesYes

Shell (.sh, .csh, .bash, ksh)

NoYesYes
Scripting Using PowerShell Core Cross Platform

To execute your script using PowerShell Core 6.0 and higher, include the following line at the beginning of your script:
#Requires -Version 6.0

For versions of PowerShell below Core 6.0, you do not need to include the above line.

Scripting Best Practices and Notes

When adding your own scripts, keep the following in mind:

  • You can create a script with the same name as an existing script because Barracuda RMM uses a GUID (Globally Unique Identifier). This GUID is automatically generated for each script, is unique when created, and is not 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. After 5 scripts, the scripts queue.
  • Scripts are never deleted automatically by Service Center.
  • Many Barracuda RMM scripts change settings that are also configurable using the 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 
    $MyInvocation.MyCommand.Path  
    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:
    set dir=%~dp0
  • 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 RMM, there are several options you can select that determine how the script runs.

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.

Dedicated Execution

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, macOS, 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.

Target Type

You can specify that a script will run on specific platforms or any platform. Supported platforms include Windows, macOS, 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 you can pass parameters. 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.

Keys for a parameter cannot be changed after saving the 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 RMM-specific variables.

Barracuda RMM-specific variablesDescription
%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.
%DeviceMacAddress%

The MAC address of the target device.

%DeviceSystemName%

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 A parameter 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 enables 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 acts 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 RMM as a check box. Flags cannot be optional because they are always true or false.

    PowerShell refers to flag parameters as switch parameters.

  • A list, which enables the user to select from a number of string values using a drop list.
  • A password with a value masked on entry and on display. The value is stored in a two-way encrypted format in the database, but it is 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.