Scripts are essential tools for the efficient management and automation of tasks.
They enable you to execute specific actions on devices, such as running custom commands or performing automated tasks. You can easily assign scripts to individual devices or policies to ensure consistent execution across multiple devices.
Step 1 - Create your first script #
![Create script | Applivery | Applivery Create script](https://www.applivery.com/wp-content/uploads/2023/10/Screenshot-2024-06-21-at-125457-1024x651.png)
A code editor will appear on the screen.
Inside the editor, you can either create a new script or upload an existing one from your device. This flexibility makes it easy to customize your scripts to your needs.
To create a new script, use the interface options and start typing.
To upload an existing script, click Load from file (4) in the editor, choose your script file, and it will be ready to use.
Finally, you must assign it a Name (5) (and optionally, a description), and click on Create (6).
![Script editor | Applivery | Applivery Script editor](https://www.applivery.com/wp-content/uploads/2023/10/Screenshot-2024-06-21-at-130057-1024x651.png)
Step 2 - Assign Scripts to your devices #
![Assign script to device | Applivery | Applivery Assign script to device](https://www.applivery.com/wp-content/uploads/2023/10/Screenshot-2024-06-21-at-132109-1024x651.png)
A modal view will appear, allowing you to choose a script from the script section or upload it from your device.
You will also have the option to select the execution method, and add the script’s arguments:
- Once: The script will run once per device. You will also have the option to repeat the execution, even if it has already been executed.
- Loop: The script will run cyclically at the chosen time interval.
- On-demand: The script will never be run automatically and will only be offered as an optional item from Self-Service.
{{device.id}}
{{device.displayName}}
{{device.serialNumber}}
{{device.osVersion}}
{{device.chip}}
{{device.isAppleSilicon}}
{{device.hostName}}
{{user.id}}
{{user.email}}
{{user.name}}
![Assign script form | Applivery | Applivery Assign script form](https://www.applivery.com/wp-content/uploads/2023/10/Screenshot-2024-06-21-at-132216-1024x651.png)
By clicking the Execution history button (4), you can view the execution history of all your scripts.
You can also access the execution history of a specific script by clicking on the script itself (5) or the three vertical dots at the end of the script. Clicking these dots (6) will also display additional actions:
- Edit: Edit the script.
- Unassign: Unassign the script from the device.
- View: View the original script in the asset section.
- For scripts with the Once execution method, you will also see the Repeat execution action, allowing you to repeat the execution if it failed.
![Script actions menu | Applivery | Applivery Script actions menu](https://www.applivery.com/wp-content/uploads/2023/10/Screenshot-2024-06-21-at-132229-1024x651.png)