We are here to help!

Find new ways to use Atera, Ask us anything.

Follow

Use Script Variables

You can create and edit scripts on the Atera platform. Once created, the script is stored in your scripts repository and can be run immediately, or scheduled via IT Automation. One useful feature is the ability to add script variables, whose value can be changed as needed.

This article explains how to add and edit scripts with variables, and define their values.

 

To add a script variable when creating a script: 

 

1. Click on Admin (in the side menu).

 

2. Then click on Scripts.

The Scripts page appears.

 

 

3. Scroll to the bottom of the Scripts page and click the drop-down next to Upload Script.

 

 

4. Click Create Script.

The Create Script screen appears.

 

 

5. a) Fill in the required fields.

b) Add your script to the Script Editor. You can add a variable to your script by typing the variable in the following format: {[variable_name]}. Don't use any spaces or special characters such as !@#$%^&*. If you do, you'll receive an error as in the example below.

 

 

6. Click Create to create the script.

The script now appears in your scripts repository. 

 

Once you've created your script, you can define the value of the variable when you run the script.

 

To run the script and define the variable's value:

 

1. From the Devices page, locate the device on which you'd like to run the script.

 

 

 

2. Click the Manage drop-down menu, and select Run Script.

 

 

The Run Script screen appears.

 

 

 

3. Click on the script you wish to run, and click Next.

 

 

 

 

If the selected script has a variable, a screen appears requesting that you specify a value.

 

 

 

4. Type a value in the field, and click Run Script.

 

 

The script runs using the variable value you added. You can also edit an existing script, including the variables.

 

To edit a script and the variables:    

 

1. Click on Admin (in the side menu).

 

 

2. Then click on Scripts.

The Scripts page appears.

 

 

 

 

3. Locate the script you wish to edit, and click on it. The Edit Script page appears.

 

 

 

 

4. Click the Edit Script button (at the bottom, right of the page). You can now edit the script in the Scripts Editor (including adding, changing or removing variables).

 

5. When finished making changes to the script, click Save (at the bottom, right of the page). Your changes are saved.

 

 

 

 

 

 

 

 

 

Was this article helpful?
2 out of 2 found this helpful
Have more questions? Submit a request