Help · Tools

Library

Scripts NinjaOne runs through the Locto Runner, and the installers, agents and certificates it deploys.

What the Library is

The Library (hub.locto.com.au/library) has two pages:

  • Scripts: Locto's shared scripts. NinjaOne runs them on client devices through the Locto Runner.
  • Files: installers, agents, drivers and certificates with fixed download links, deployed by NinjaOne.

Who can do what

Your access is set per tool by hub admins in Settings › People & access (see People and access).

Level Scripts Files
None No access. No access.
View Search, read, copy and download scripts. See the NinjaOne tab and history. See, search and download files.
User Also add scripts, edit them (each save is a new version), restore an old version, and archive scripts you wrote. Same as View.
Admin Also verify scripts (the approver role), stop earlier versions, archive any script, import and restore, and manage categories and tags. Also upload, edit, replace, archive and restore files, set up the NinjaOne tab and PFX passwords, and delete files for good.

Scripts

Finding a script

Search titles, descriptions, tags and code, then filter by category, language or tag, or tick Verified only or Mine. Open a script for its tabs: Script, NinjaOne, Parameters & notes and History. Copy and Download give you the code.

Placeholders

A script can contain placeholders such as {{Mailbox}}. When you open it, a box appears for each one. Copy and download use the values you type. They stay in your browser until you close it.

NinjaOne never fills placeholders: the runner sends the code exactly as saved. Scripts for NinjaOne should take values as parameters instead.

Adding and editing a script

Click New script, fill in the details and code, then click Add to library.

To change a script, open it and click Edit, then Save changes. If someone saved in the meantime, you're asked to reload and re-apply your changes.

Don't put passwords or client secrets in scripts. Every script is backed up to GitHub.

Versions and history

Every save makes a new version (v1, v2 and so on). Earlier versions are kept. On the History tab you can compare two versions and Restore an old one. Restoring saves it as a new version, so nothing is lost.

Verified scripts

NinjaOne only runs scripts marked Verified. Verified means a Library admin (an approver) has reviewed and tested that exact code.

  • An admin clicks Mark verified at the bottom of the script or on its edit page. If the script changed since the page loaded, nothing is verified and the new code is shown for review.
  • Changing a script's code or language clears Verified. Changing only the title, tags or notes doesn't.
  • A second person should review a script before it's verified.

Running a script from NinjaOne

You don't copy the script into NinjaOne. NinjaOne runs one stub script, the Locto Runner, as it is. You fill in its script variables:

  • ScriptId (required): the Script ID from the script's NinjaOne tab. It never changes when the script is edited.
  • Arguments (optional): values passed to the script, for example -Days 30 -Name "Front desk" -Force. They're passed as plain text: $env:COMPUTERNAME arrives as that text, not the computer name.
  • Version and ExpectedSha256 (optional): see Pinning a version.

The runner reads its key from the NinjaOne Secure custom field loctoScriptRunnerKey, fetches and checks the script, runs it and returns the output and exit code to NinjaOne.

Which version NinjaOne runs

The NinjaOne tab shows NinjaOne runs. With Version blank, that's the newest Verified version. If the latest version isn't Verified yet, NinjaOne keeps running the newest earlier Verified version until an admin verifies the new one.

Pinning a version

To lock a job to one version, copy Version and SHA-256 from the NinjaOne tab's Versions box into the runner's Version and ExpectedSha256. SHA-256 is a fingerprint of the code; if the code differs at all, the job refuses to run. A pinned version must still be Verified.

Checking what ran

Recent NinjaOne fetches lists the last 100 downloads: device, organisation, version, and whether it was served or refused (and why). It logs the download, not the result. The output and exit code are in NinjaOne's activity log. Runner failures start with LOCTO RUNNER ERROR; open Arguments and runner exit codes for what each code means.

Stopping earlier versions

If the latest version isn't Verified but NinjaOne is still running an earlier one, an admin can click Stop the runner using earlier versions. NinjaOne then refuses the script, pinned jobs included, until a version is verified again. Those earlier versions can't be made runnable again.

The runner stubs

NinjaOne runner setup (one-off) on the NinjaOne tab has the setup steps and both stubs: LoctoRunner.ps1 for Windows (run as System; PowerShell and batch scripts) and locto-runner.sh for Mac and Linux (run as root; bash and Python). Both use the same variables and key field.

Archiving a script

Archive (at the bottom of a script) hides it from the list and stops NinjaOne running any version of it. Nothing is deleted. Tick Include archived to find it, then Unarchive. If it was Verified, NinjaOne can run it again straight away. The author or a Library admin can archive.

Categories and tags

Settings shows the categories and tags. Library admins add and remove them; removing a category moves its scripts to another.

Export, import and backups

Export downloads the filtered scripts as JSON. Library admins can Import a file, or Restore from backup to put back a lost library exactly as it was. Every change is also committed to the private GitHub repository LoctoIT/LoctoScripts, with a full export each night.

Scripts from Claude

With the Locto connector in Claude: search_scripts and get_script find and read scripts; list_script_versions shows history; save_script adds a script and update_script saves a new version. Scripts saved from Claude start unverified.

Files

Download links work without signing in, so anyone with a link can download the file. Don't upload licence keys, passwords or client data.

Uploading files

Click Upload, drop in one or more files (up to 20 GB each), choose a folder and add a description and tags.

Folders and tags

Each file sits in one folder; pick an existing one or type a new name. Tags (for example a customer or vendor name) are extra labels. Click a folder chip or a tag to show only those files.

Open a file to see Download, Copy link and the Download link. The link stays the same when the file is renamed or replaced. New link makes a new one and stops the old link working at once; use it if a link has been shared where it shouldn't be.

SHA-256

Every file has a SHA-256 hash, a fingerprint of its contents. The PowerShell and Bash snippets on the Download tab check it after downloading.

Replacing a file and versions

Replace file uploads a new version under the same name and link. The old version is kept under Earlier versions and in the Archive, and can be made current again. Scripts that check the hash need the new SHA-256.

Archiving and deleting files

Archive takes a file out of use: its link stops working. Nothing is deleted. The Archive button on the Files page shows archived files and earlier versions; a Library admin can restore them with the same link. Only a Library admin can delete a file or an earlier version for good, from the Archive, by typing its name to confirm.

The NinjaOne tab

The NinjaOne tab replaces NinjaOne's File transfer and Install application. You set up here what happens to the file; the NinjaOne job only passes the file's link to the deploy script, which downloads it, checks its SHA-256 and carries out the settings. Changing the settings or replacing the file needs no change in NinjaOne.

Transfer, Install or Certificate

  • Transfer copies the file to a Windows folder (for example C:\Support\) and/or a **Mac folder** (for example /Users/Shared/Locto/). The folder is created if missing. Tick **Overwrite** to replace a different file (the old one is kept as .previous). A ZIP can be extracted instead.
  • Install runs an installer silently: .msi, .exe (add silent switches), .msix, .ps1 or .cmd on Windows; .pkg, .dmg or .sh on a Mac. Set the success exit codes, a time limit, which processors, and up to five helper files. The device is never restarted.
  • Certificate imports a .cer, .crt, .pem, .der, .pfx or .p12 into a Local Machine store (on a Mac, the System keychain). Expired certificates are refused.

PFX passwords

A .pfx holds a private key, so it must have a strong password. Choose where the password comes from:

  • Saved in Library: type it once and save. It's kept in Azure Key Vault and can't be shown again; type a new one to replace it. Devices fetch it with the runner key. Optionally list NinjaOne organisations (names exactly as in NinjaOne) under Only for these NinjaOne organisations; other devices are refused.
  • NinjaOne custom field: the password sits in a NinjaOne Secure custom field (for example loctoPfxPassword) and the script reads it there.

The password is never put in the job's Arguments.

Running the deploy scripts

Once saved, the tab shows Run it from NinjaOne on Windows and/or on a Mac. Run the Locto Runner stub as it is (System on Windows, root on a Mac) and copy in:

  • ScriptId: the library script Deploy a Locto Tools file (Windows) or Deploy a Locto file (Mac). It's the same for every file.
  • Arguments: the file's link. Only this changes between files.

Leave Version and ExpectedSha256 blank. Both deploy scripts must be Verified.

Pin to this version

Tick Pin to this version of the file to add the file's SHA-256 to Arguments. The job then stops if the file is replaced, until you update the job.

In Claude, find_files searches files by name, folder or tag and returns each link and SHA-256.

Problems and questions

Script problems

Exit code 4 (couldn't fetch). Check the ScriptId, that a version is Verified and the script isn't archived. The reason is in the output.

Exit code 3. The device can't read loctoScriptRunnerKey. Check the field is set for that organisation.

Exit code 6. The script changed since the job was pinned. Update ExpectedSha256 (and Version) once the new version is verified.

NinjaOne still runs the old version. Expected until an admin verifies the new one.

File problems

A file link stopped working. The file was archived or given a new link.

I can't see Upload. Uploading and changing files needs Library Admin access.

The NinjaOne tab says the deploy script isn't Verified. Ask a Library admin to review it in Scripts.

A .pfx import fails. Check the password source and the organisation list.