> ## Documentation Index
> Fetch the complete documentation index at: https://docs.neoagent.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Scripts

> Keep PowerShell scripts in Neo, in folders, and approve the version Neo may run on your RMM-connected endpoints

**Scripts** holds your team's own PowerShell scripts, stored in Neo for your workspace only. An admin or owner approves a version of a script before Neo may use it.

> [!NOTE]
>
> Approving a version lets your agents run it on your RMM-connected endpoints. Approve it where you can read all of it: on this page, or on its approval card in a chat with Neo.

## Versions and approval

Each save of a new script body makes a new version. Neo never changes a saved version.

* An admin approves one version: the latest one, as they read it. If someone saves a newer body in the meantime, the approval fails and the admin reads the new body first.
* Neo refuses to save a body with a password, key or token, because a saved version never changes and everyone who can read Scripts can read it.
* Neo refuses to approve a body it would not run: characters that show as nothing or reorder text, a line starting with ` ``` ` or `~~~`, content it decodes (`-EncodedCommand`, Base64 or hex), or a password, key or token.
* A script that reaches the network or another machine when it runs (a download, a network share, a remote command, a module or package from a gallery) can be approved and tested, but the approval does not cover what it fetches, so every agent run of it asks a technician, even with [Requires approval](#requires-approval) off. Neo spots these by known commands, so read every script before you approve it and before you turn Requires approval off.
* A script that adds a local user or a member of the local Administrators group, creates a Windows service, creates or changes a scheduled task, or changes the Windows firewall can be approved too, and every agent run of it asks a technician, even with [Requires approval](#requires-approval) off. Its approval card opens with a warning line that names the change.
* Neo runs the approved version. While a newer version waits for approval, Neo keeps running the approved one. The list shows this as **Runs v2 · v3 pending approval**.
* A change to the name, description or folder makes no new version. Agents pick scripts by name and description, so on an approved script only an admin or owner changes them, and Neo stops running the script until an admin or owner approves it again under the new name. A move to another folder keeps the approval.
* To go back to an old version, open the script's **History**, select the version and choose **Restore**. Neo copies it into a new version, which an admin approves before Neo runs it.
* Archiving a script stops Neo from running it and removes its approval. Every version stays in the history. Restoring an archived script brings it back with no approved version.

| Status | Meaning |
| - | - |
| **Draft** | The latest version is saved, not sent for review. A script Neo saves after an agent runs it starts here, in **Written by Neo**. |
| **Pending approval** | The latest version waits for an admin or owner. A version an agent or an API key writes starts here, marked **Written by an agent**. |
| **Approved** | Neo runs the latest version. |
| **Renamed: needs approval again** | The name or description changed after the approval. Neo runs no version until an admin or owner approves the script again. |
| **Archived** | Kept, but out of use. |

## Scripts Neo wrote

When an agent runs a PowerShell script it wrote with [Execute PowerShell on Device](https://docs.neoagent.io/agents/tools/rmm/execute-powershell-on-device.md) and the run succeeds, Neo saves that exact script here as a draft, marked **Written by an agent**. Review it, then submit or approve it to keep it in your library, or archive it.

* The draft goes in the top-level folder **Written by Neo**. Neo creates it on first use and keeps using it after you rename or move it.
* The name is the agent's reason for the run plus the first characters of the script's hash. The version note names the device and the ticket.
* A card above the script's tabs shows where the script came from. Its headline says which version Neo runs, who approved it, and which version waits for approval. Below it, one row for the latest version, and one for the version Neo runs when that is an older one: who wrote it, its source (the ticket, a Neo Support chat, or the Scripts library), the device Neo ran it on with **Open the run**, and when. A version someone saved after Neo's shows as their change, which Neo did not run.
* The ticket links to your PSA when Neo can build the link. A long ticket ID is shortened; hover it for the full ID, or copy it with the button beside it.
* A member whose role does not reach that agent's runs sees no ticket, device or run on the card and no version note in **History**, and reads **An agent** as the author.
* A failed, timed-out or test-mode run saves nothing, and so does a run of a library script.
* Neo saves nothing when any version of a script in your library, archived ones included, already holds the same body, or when the save would pass a limit below.

## Test a version on a device

An owner or admin can run any saved version (draft, pending or approved) on one device before approving it. Open the script, pick a device in the **Output** panel and select **Run version**. The script runs once, as the RMM agent's account, usually SYSTEM, and its output shows in the panel when the run ends.

* Save your changes first: only a saved version runs.
* The list shows devices of RMMs where Neo runs PowerShell and the Neo wrapper script `[Neo Script] Run Powershell` is uploaded. Not N-able N-central, ScreenConnect, Syncro or Addigy devices.
* Each device shows its RMM device ID and, for NinjaOne, Datto RMM and ConnectWise Automate, the day the RMM last saw it, so two entries with the same name can be told apart.
* The run records the version and who ran it.
* The script's **Tests** tab lists its test runs, newest first: when, who ran it, the version, the device and its RMM, and the status. An owner or admin selects a run to read its output. Neo keeps the newest 100 test runs of each script, with up to 20,000 characters of output each. The tab name shows how many runs passed (green check) and failed (red cross), and how many still run (grey clock). A **+** after them means older runs are not loaded yet.

When an approved version is in place, an agent can run it with [Execute PowerShell on Device](https://docs.neoagent.io/agents/tools/rmm/execute-powershell-on-device.md#library-scripts). Each run asks a technician first while [Requires approval](#requires-approval) is on, the default.

## Requires approval

**Requires approval** says whether every agent run of a script asks a technician first. It is on for every script, existing and new, including an RMM script your RMM adds later. An owner or admin turns it off per script, for every agent of your workspace.

| Requires approval | What an agent does |
| - | - |
| **On** (default) | Every run asks a technician first, on every agent, whatever the agent's **Require Technician Approval** says. |
| **Off** | The agent runs the script with no per-run approval, with any variables. |

* Applies to Neo library scripts and to the scripts in your RMM that agents run with [Execute RMM Script](https://docs.neoagent.io/agents/tools/rmm/run-rmm-script.md).
* A job an agent starts through the [RMM API](https://docs.neoagent.io/agents/tools/rmm/rmm-api.md) tool, outside Execute RMM Script, follows the RMM group's **Require Technician Approval**.
* With it off, the agent still needs script execution at **Read & Write** on the RMM's permission group, and its other limits, such as its companies, still apply.
* A library script runs only its approved version. One that reaches the network or another machine when it runs always asks.
* A [supervised run](https://docs.neoagent.io/core/supervised-mode.md) asks before every script.
* A PowerShell script an agent writes always asks and has no setting.
* An RMM script's setting follows the script's ID in the RMM, so it stays when someone edits the script in the RMM.
* The script records who changed the setting and when.

One change can set many scripts: a list of scripts, every script of a folder and the folders inside it, or every script a search matches.

An owner or admin changes the setting as a person: in a chat with Neo, which asks for approval of the exact change first and names each script, or through the [API](#api) with their own dashboard sign-in. An API key or an AI agent over MCP never changes it.

## Who did what

The script shows who created it and who approved the version Neo runs, by name and email, with the date. The **History** tab shows who wrote and who approved each version, and the changes between a version and the one before it.

When the Neo Support Agent makes the change, the record names the agent and the person it acted for. When an API key makes it, the record names the key.

## Folders

Folders keep your scripts in order. They nest up to five levels deep, and a script sits in one folder or at the top level.

* Folder names are unique inside their parent folder.
* Select **Rename or move…** on a folder to rename it or move it into another folder.
* You can delete a folder only when it is empty. Move its scripts, archived ones included, and its folders out first.
* Script names are unique across your workspace, whatever folder a script is in.
* Script and folder names are one line: no line break or tab.

## Limits

A workspace holds at most 2,000 scripts (archived ones count), 500 versions of one script, 20,000 versions in all, and 50 MB of saved versions in all. Drafts Neo saved on its own in **Written by Neo** do not count until someone edits, submits or approves them. Neo keeps up to 500 of those drafts, and saves no new one past that. A workspace saves at most 60 scripts or versions a minute. A save past a limit is refused with a message that names it. To raise a limit, ask Neo support.

## Add and approve a script

**1. Open Scripts**

Open [**Scripts**](https://dashboard.neoagent.io/script-library). Select a folder, or stay on **All scripts**, then select **New script**.

**2. Write the script**

Give it a name, a description, a folder and the PowerShell body, then select **Add script**. It is saved as a draft, version 1.

**3. Get it approved**

An admin or owner opens the script, reads the body and selects **Approve…**, then **Approve version 1**. A member who is not an admin selects **Submit for approval** instead.

An Owner or Admin can also ask the [Neo Support Agent](https://docs.neoagent.io/chat-agents/neo-support-agent.md) to add a script, save a new version or restore an old one. It shows the body before you approve it.

To approve a version in the chat, Neo shows the stored script on the approval card: its name, folder, description, version, who wrote it and the whole body. A body over 3,000 characters does not fit the card: approve it here.

## Scripts in your RMM

Under **Source**, select an RMM to list the scripts Neo synced from it, for example [**Scripts** → **Datto RMM**](https://dashboard.neoagent.io/script-library?source=DATTO). **Neo library** shows your own scripts. A workspace with several RMMs connected has one entry for each.

* Each row shows the script's name, description, RMM script ID, category and variable names. Search by name or ID; a long list shows 50 scripts a page.
* VSA X, CW Automate, ConnectWise RMM, NinjaOne and Addigy show your scripts in the folders you use in the RMM, with the number of scripts in each folder. Open a folder to see the folders inside it, then its scripts. A search looks in every folder, and each result shows its folder. The other RMMs show one list.
* A script in two Addigy categories shows in both folders. A NinjaOne script for an operating system that has no device in NinjaOne shows only under **All scripts**.
* The RMM owns these scripts, so the list is read-only: no edit, approval or test run. Change a script in the RMM, and Neo shows the change after the next sync.
* The time of the RMM's last sync shows above the list for a role that reads integrations.
* Every agent run of an RMM script asks a technician first. To let agents run one without asking, an owner or admin turns its [Requires approval](#requires-approval) off. For a whole folder, open it and use **Set every script in** that folder **and its folders**.

With no RMM connected, the page links to [**Integrations**](https://dashboard.neoagent.io/integrations?category=RMM) to connect one.

## Who can do what

**Scripts** is its own area in [Roles & Access](https://docs.neoagent.io/product/rbac.md#roles).

| Role | Read | Add, edit, file, submit, archive, restore | Approve |
| - | - | - | - |
| Owner, Admin | Yes | Yes | Yes |
| Builder | Yes | Yes | No |
| Operator | Yes | No | No |
| Everyone alone, No Neo account | No | No | No |

Any role can give the Scripts section at read or write, and Builder and Operator can be edited. Only an admin or owner approves, whatever a role gives, and always as a person: on the Scripts page or in a chat with Neo. An API key never approves a script. In Neo Support chat, only an Owner or Admin manages scripts.

## API

The same actions are on the public API under `/public-api/script-library`, with the scopes `script_library:read` and `script_library:write`. A key needs one of these scopes; a `tenant_config` scope does not reach scripts. An approval sends the `latest_content_sha256` of the body and the `metadata_sha256` of the name and description the approver read, and fails with `409` when either changed since. A script renamed since its approval has `renamed_since_approval: true`, and its `status` is that of its latest version: `PENDING_APPROVAL`, or `DRAFT` when a newer version was saved and not submitted. An admin or owner then approves the latest version as usual. Every record names its actors with `kind` (`USER`, `AGENT` or `API_KEY`), `id`, `name` and `email`. A script or version Neo saved after a run carries `neo_run`: the version Neo wrote, the agent, the run id, the ticket and its PSA link, the device and when the run ended. A caller who may not read that agent's runs, or a key without the `executions:read` scope, gets `neo_run: null`, like any script Neo did not save; version 1's note names the device and the ticket for every reader. `GET /public-api/script-library/{id}/test-runs` lists a script's test runs, newest first, with `page_size` and `cursor`. Each run has `output` and `error_message` only when an owner or admin reads it as a person, on the dashboard or in a chat with Neo (`output_visible`); an API key reads the list without them. The Requires approval setting is `requires_approval` on a script, set with `PUT /public-api/script-library/{script_id}/run-rule` and `POST /public-api/script-library/run-rules` for library scripts, and under `/public-api/rmm-script-run-rules` for RMM scripts; an API key gets `403` on every setting change. See the [API introduction](https://docs.neoagent.io/developers/introduction.md).

The scripts Neo synced from a connected RMM are on `GET /public-api/rmm-scripts?vendor=<RMM>`, sorted by name. When `has_more` is true, pass `meta.pagination.next_cursor` as `cursor` to read the next page. Each script has `folders`, its folder paths in the RMM (folder names joined by `/`). `GET /public-api/rmm-scripts/folders?vendor=<RMM>` lists every folder `path` with its `script_count`; pass a path as `folder` to the list to read the scripts in that folder.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.