Skip to main content

Create Custom Scripts

Learn how to create a custom script.

Updated over a week ago

The Create Custom Script feature in Trio allows administrators to define, configure, and launch OS-specific scripts directly from the console. These scripts can automate administrative tasks, troubleshoot devices, or enforce one-time actions across endpoints running Windows or macOS.

This functionality is especially useful for IT teams needing granular control over device operations outside the lifecycle of a policy. Whether the task is to retrieve system logs, update software, or set specific configurations, custom scripts offer a powerful and flexible solution.

Prerequisites

Only users with appropriate scripting or software execution permissions can access and use this feature. These permissions are typically available to roles such as Super Admin, IT Admin, or custom roles with scripting privileges.

Target devices must:

  • Have the Trio agent installed and active

  • Be online or capable of receiving queued instructions

  • Match the OS type (macOS or Windows) selected for the script

Access path:
Fleet → Scriptor → Scripts → + Create script → Normal script / After agent installation

Step-by-Step Guide

Step 1: Launch the Create Script Dialog

From the Scriptor module under Fleet, click the + Create script button. You’ll be prompted to choose between:

  • Normal script – for ad-hoc or reusable scripts

  • After agent installation, for scripts that should run immediately upon device enrollment

Select Normal script to begin defining a standalone script.

A modal window appears where you enter:

  • Script name – A short, descriptive title

  • Description – Optional notes about script behavior or purpose (e.g., “Rotate encryption key”)

Click Confirm to continue.

Step 2: Configure Script Details

The script editor opens with advanced configuration options. This is where you define how and where the script will execute.

You must provide the following:

  • Operating System – Select either Windows or Mac

  • Environment – Choose the shell or interpreter:

    • For Windows: CMD or PowerShell

    • For Mac: Default is bash/zsh

  • Script Content – Input or paste the code to be executed. This is the main logic block. You can also copy from provided templates to speed up authoring.

Additional configuration includes:

  • Launch Method – How the script will be triggered:

    • Manually

    • On a schedule

    • As a repeating task

    • Via webhook

  • Timeout – Maximum runtime before force termination

  • Expiration – Defines how long the script will remain valid for execution (e.g., 3 days)

  • Smart defaults toggle – Lets the system apply recommended execution parameters

If needed, you may attach files required by the script (max size: 2MB) and specify their destination path on the device.

Click Create to finish.

Step 3: Assign Script (Optional)

Once the script is saved, a modal confirms successful creation:

Script has been created! Do you want to assign this script to your groups?

You can choose:

  • Assign – Opens the script assignment panel

  • Done – Skips assignment (script remains in library)

If you choose Assign, you’ll be prompted to pick either:

  • Groups – Script runs on all devices in selected group(s)

  • Devices – Script runs on manually chosen devices

Assignments can also be managed later via the script list view.

Confirmation and Execution

Once a script is created, it is stored in the Scripts tab. Each script entry includes:

  • Script name

  • OS and environment

  • Execution method (manual, schedule, etc.)

  • Privilege level (Run as System or Root)

  • Assignment status (groups/devices)

The green toast notification confirms:

Success – New script has been added to the library.

Scripts can now be triggered, modified, or deleted from this interface.

System Behavior Notes

  • Scripts are executed only once unless scheduled or repeated.

  • Scripts targeting devices currently offline will queue and execute once the device comes online.

  • Execution feedback appears in the Results tab, including logs, output, and failure reasons.

  • If file upload is required, ensure the destination path is writable by the agent.

  • After creation, scripts can be duplicated or versioned to simplify ongoing operations.

Troubleshooting

  • Script not executing? Ensure the target device is online, assigned correctly, and compatible with the OS and script environment.

  • Missing launch options? Your role may not have permission to use advanced triggers like webhooks or scheduling.

  • Failure on execution? Check for syntax errors, missing file permissions, or timeout misconfiguration.

If you have more questions regarding scripts, please contact the Trio team.

Did this answer your question?