Skip to content
MoftgateMoftgate Docs
Product guide

Scripts

Create, target, and run command sequences on managed endpoints, and read the result of every endpoint.

What Scripts Are#

Scripts are reusable command sequences that run on managed endpoints. They are the on-demand counterpart to automations: the same execution capability, triggered by a person instead of an event.

Need a starting point? Copy a tested script from the script library.

Because a script can change a device, the platform treats it as a sensitive operation: it needs an explicit target, an explicit confirmation, and it is recorded per endpoint.

Reusable script library with groups, languages, and OS filters.
Scripts library screen
Close image

Creating a Script#

A script definition has five parts. Fill them in so the next operator does not have to read the body to understand the intent:

FieldWhat it controls
Name and descriptionIdentifies the script in the library and explains what it does to the next operator.
Target operating systemScripts are written for a specific shell, so the operating system decides which interpreter runs them.
Script bodyThe command sequence the agent executes on the endpoint.
Target scopeGroups, profiles, tags, or individual endpoints the script may run on.
Run asWhether the script runs with system privileges or as the current operating system user.
Write for the target shell
A script written for a Windows shell will not run correctly on a Linux endpoint. Set the target operating system so the script is only offered where it can work.

Running a Script#

  1. 1
    Select the script

    Open the script from the library and review its body and target operating system before you run it.

  2. 2
    Choose the target

    Select groups, profiles, tags, or individual endpoints. Run on one endpoint first when the script is new.

  3. 3
    Confirm the action

    Running a script is a sensitive operation, so it requires an explicit confirmation. Review the resolved endpoint list in the confirmation step.

  4. 4
    Review the output

    Each endpoint returns its own exit status and output. Read the failures individually; a partially successful run is the common case.

Pilot on one endpoint
Run a new or changed script on a single endpoint first. Bulk execution turns a mistake into an incident, and a script bug is much cheaper to find on one device.

Results and Logging#

  • Every endpoint reports its own exit status and output; results are not merged into one summary.
  • A partially successful run is normal when endpoints differ, so read failures individually.
  • The run is attributed to the operator who started it.
  • Script execution is recorded in the activity log and the audit log.

Frequently Asked Questions#

How is a script different from an automation?
A script is a command sequence an operator runs on demand. An automation runs a pipeline in response to a trigger. Use a script for one-off work and an automation for anything repeatable.
Are script runs logged?
Yes. The run, its target endpoints, its operator, and each endpoint result are recorded. Script execution is also written to the audit log.
What happens if an endpoint is offline?
The run is queued for that endpoint and executes when it reconnects, unless the run has a time limit. Check the last-seen time if a result never arrives.
Can I restrict which scripts an operator may run?
Yes. Permissions decide who may create and run scripts, and the target scope limits which endpoints a script may reach.