Introduction
The script library is where you create, organize, and maintain scripts that can be used in automations, script monitors, and ad-hoc runs from the device listing or device details. Scripts are saved once and reusable across your entire environment β change a script in the library and the update is reflected everywhere it's referenced.
Scripts
Go to Scripts in the sidebar.
The left sidebar has three fixed items at the top:
All scripts β shows every script in your library, across all groups
New script β opens the Create script dialog
Ungrouped scripts β scripts not yet assigned to a group
Below those, the Script groups section lists any custom groups you've created. Select a group to filter the table to scripts in that group only.
The main table shows all scripts matching the current selection. Columns include Name, Group, Description, Type (language), and Created. Click any script name to open it in the editor.
Creating a Script
Click + Create script in the top right, or New script in the sidebar. A dialog appears asking for a name.
Enter a name and click Create. The script editor opens immediately.
π‘ TIP: Name scripts specifically β "Disable Guest Account - Windows" is easier to find and reuse than "Guest Account Script." You can always rename later.
Script Editor
Each script has four tabs in the left panel: Script, Variables, Linked automations, and Linked monitors.
The configurable fields:
Script name β the name shown in the library and in the Run Script action picker.
Description β optional. Shown in the script listing. Worth filling in for shared libraries.
Language β the scripting language. Supported options:
Ansible
Bash
Go
osquery
PowerShell
Python
Zsh
Timeout (in seconds) β how long Level waits for the script to complete before marking the run as failed. Default is 100 seconds.
Run as β the account context the script runs under:
Option | Behavior |
Local system | Runs as the SYSTEM account β elevated, no user context |
Current user | Runs as the logged-in user β use this for user-context operations like applying wallpaper or configuring per-user settings |
The code editor occupies the right side of the screen. Write or paste your script directly. Click {x} in the bottom-right corner of the editor to insert a variable, system variable, or custom field reference inline.
Click Save script to save. Changes don't take effect until saved.
β οΈ WARNING: Unsaved changes are lost if you navigate away. Save before leaving the editor.
Variables
The Variables tab shows any script variables declared for this script. Script variables are named output slots β the script writes a value to them during execution, and you can map that value to an automation variable in the Run Script action panel to pass it forward through the pipeline.
Click + Add new variable to define a new variable. Once defined, variables appear in the Script variables section of any Run Script action that references this script.
βΉοΈ NOTE: Script variables capture output from a script. To pass data into a script β device context, custom field values, system info β use the {x} picker in the code editor to reference variables or custom fields inline.
For the full reference on mapping script variables to automation variables and using them in subsequent actions, see Run Script Action, Automation Variables, and System Variables.
Linked Automations
The Linked automations tab lists every automation that references this script via a Run Script action. Click any automation name to open it.
βΉοΈ NOTE: A script can't be deleted while it has linked automations. You'll need to remove the script from each referencing automation first, or delete those automations. The tab makes it straightforward to see exactly what would be affected.
Linked Monitors
The Linked monitors tab lists any script monitors using this script. Same deletion rule applies: unlink from all monitors before a script can be deleted.
Organizing with Script Groups
Script groups let you categorize scripts by platform, function, team, or whatever makes sense for your environment. Groups appear in the sidebar under Script groups and as a column in the script listing.
To create a group, click the + icon next to Script groups in the sidebar. A dialog appears asking for a group name.
To assign a script to a group, open the script's Actions menu (top right) and select Assign to group.
π‘ TIP: Script groups typically reflect purpose or role β Security, Software, Monitors, Utilities β not the structure of your device groups. Organizing by function makes it easier for the whole team to find the right script regardless of which devices it runs on.
Deleting a Script
Open the script's Actions menu and select Delete. A confirmation dialog appears.
β οΈ WARNING: Script deletion can't be undone. If the script has linked automations or monitors, Level blocks the deletion β remove all links first using the Linked automations and Linked monitors tabs.
Running Scripts
Scripts can be executed in several ways:
In an automation β via the Run Script action. The script runs on each target device as part of the automation pipeline. This is the primary way to run scripts at scale or on a schedule. See Run Script Action for the full reference.
Ad-hoc from the device listing or device details β select devices and open the Actions menu. Three script-related options appear:
Run saved script β pick a script from your library. Level creates a new script run automation with two actions: Wait for approval and Run script.
Run new script β write a new script on the spot. The script is saved to your library and a script run automation is created for it.
Add to recent script run β add the selected devices to an existing script run automation rather than starting a new one.
In a script monitor β a monitor runs a script on a schedule and evaluates its output to determine device health. See Script Monitors for setup details.
βΉοΈ NOTE: Script run automations are reusable. You can rename them, move them to a group, add more actions, or adjust their trigger before approving. The script won't execute until the Wait for approval step is manually approved. All script runs are tracked under Automations β Script runs in the sidebar.
FAQ
What's the difference between Run saved script, Run new script, and Add to recent script run? All three are in the Actions menu on the device listing and device details. Run saved script picks an existing library script and creates a new script run automation for it. Run new script lets you write a new script on the spot β it's saved to the library and a script run automation is created. Add to recent script run adds the selected devices to an existing script run automation rather than starting a new one. In all cases, the script won't execute until the Wait for approval action is approved.
What's the difference between a saved script and a Shell action? A saved script lives in the library and is reusable β reference it from any automation, monitor, or ad-hoc run, and changes in one place update all references. The Shell action runs a script written inline in the automation, with no library entry. Use saved scripts for anything you'll run more than once or want to maintain over time.
Can I edit a script without breaking automations that use it? Yes. Changes to a saved script take effect the next time any referencing automation runs β there's no need to update the automation itself. The Linked automations tab shows exactly which automations will be affected.
What languages does Level support? Ansible, Bash, Go, osquery, PowerShell, Python, and Zsh.
Can a script pass output to subsequent automation actions? Yes β two ways. Define script variables in the Variables tab and map them to automation variables in the Run Script action panel. Or use Assign action output to variable in the action's Additional options to capture the full script stdout. See Run Script Action for details.
Who can create and edit scripts? Technicians with permission to edit automations in the relevant group. See Workspace β Permissions for access control configuration.
What happens to automations if I delete a script? Level blocks deletion of a script that's linked to active automations or monitors. Use the Linked automations and Linked monitors tabs to see what needs to be unlinked first.







