# Creating remote actions

To create a new remote action:

1. Select **Remote Actions** from the main menu.
2. Click on the **New** button at the top of the navigation menu.

<figure><img src="/files/Dw9elA9iHyBankUroDkw" alt="RemoteActions - 1707382332.png" width="760"><figcaption></figcaption></figure>

Alternatively, create a new remote action through the Administration page:

1. Select **Remote Actions** > **Manage remote actions**.
2. Click on the **New remote action** button in the top-right corner of the page.
3. Fill in all necessary information and click on the **Save Remote Action** button.

The **New remote action** page includes 2 configuration tabs to define the remote action.

## General tab <a href="#managingremoteactions-general" id="managingremoteactions-general"></a>

Enter the name, NQL ID, description, triggering options, targeting options and purpose of the remote action.

#### **Triggering**

Select the triggering mechanisms for the remote action​:

* **Manual**: Trigger the remote action manually from the web interface.
* **API**: Trigger the execution on selected devices via API​.
* **Workflow:** Enable the listing and execution of remote actions using the Remote action Thinklet workflow.
* **Schedule**: Trigger the execution using an NQL query at the scheduled time.
* **Spark:** Make the remote action available for Spark. You should also grant Spark permission to run the designated remote action. Refer to [Enabling Spark permissions](/platform/user-guide/spark/setting-up-and-managing-spark/managing-agent-actions.md#enabling-spark-permissions) for more details.

{% hint style="warning" %}
When you execute a remote action on an on-demand basis (manually, through a workflow or API), the system prioritizes it over scheduled remote actions. This ensures concurrent scheduled remote actions do not delay on-demand remote action executions.
{% endhint %}

#### **Targeting**

Select which environments the remote action should target:

* **Devices**: Enable the remote action to target specific devices.
* **VDI session**: Enable the remote action to target VDI sessions.
  * When targeting a session, choose whether to target:
    * **VDI:** The remote action targets the VDI device for that session.
    * **Client:** The remote action targets the client device from which the user connects to the VDI session. Note that this only works if Collector is installed on the client device.
  * Optionally, allow the user to override the above selection.

#### **Purpose**

Select the purpose for the remote action:

* **Data collection**: The intent of the remote action is to collect data from the targeted device.​
* **Remediation**: The intent of the remote action is to perform an action on the targeted device.

## Script <a href="#managingremoteactions-script" id="managingremoteactions-script"></a>

Import a remote action script for Windows and macOS platforms. Once imported, fill in the **Parameters** field, and the **Outputs** information appears.

Use the **Advanced Configuration** option to select the context for executing the script, and the options available include local system, interactive user or service.

To save the remote action, you must add a Windows PowerShell or macOS Bash script.

Library-pack updates overwrite existing scripts and all configurations of the remote action, requiring you to re-sign it after the update. Therefore, for remote actions installed from the library and system remote actions, Nexthink recommends against making any modifications other than re-signing the script.

Refer to the [Writing scripts for remote actions on Windows](https://docs.nexthink.com/platform/user-guide/remote-actions/managing-remote-actions/writing-scripts-for-remote-actions-on-windows#writingscriptsforremoteactionsonwindows-outputvariables) and [Writing scripts for remote actions on Mac](https://docs.nexthink.com/platform/user-guide/remote-actions/managing-remote-actions/writing-scripts-for-remote-actions-on-mac#creating-output-variables) documentation for more information.

{% hint style="info" %}
Remote action scripts have a 600 KB maximum size limit:

Up to 50 inputs with a maximum total of 30 KB characters.

Up to 50 outputs with value limits depending on the type.
{% endhint %}

<figure><img src="/files/rJFrGqjLWHZt3uJ0NwZb" alt="RA - 1710253477.png" width="760"><figcaption></figcaption></figure>

#### **Parameters**

You can specify up to 50 inputs required for the script's execution. You have the option to define a list of permitted parameter values and enable users to provide a custom value during execution.

* **Name**: The name that appears to the user when the system asks for a parameter value.
* **Description**: A meaningful description of the parameter.
* **Value**: List of possible values for the parameter, one value per line. At least one value is required. The value on the first line is the default value option.
* **Allow the user to enter a custom value**: Allow users to specify a custom parameter value other than those included in the list.

#### **Outputs**

Define up to 50 outputs of the remote action.

* **Name**: The name that appears when the system displays remote action outputs in investigations and dashboards.
* **Description**: A meaningful description of the output parameter.
* **Type**: The data type of the parameter.

#### **Advanced Configuration**

Choose to run the script as a local system user (default), as an interactive user or as a service:

* **Local system user:** Use this for tasks that require system rights, for example to uninstall software, or get the value of system information like drivers or registry keys.
* **Interactive user:** Use this for actions executed for a specific user, like getting the size of their recycle bin, or closing an application using a campaign. If these were to be run as Local system user they would return the size of the system user recycle bin, or would try to close applications used by the system instead of the user logged into the device.
* **Service:** Use this to configure the remote action to run within a dedicated service. For example, remote action can run on a Windows server (proxy) using a service account that has the necessary permissions to update Active Directory. Running as a service is only supported on Windows devices and requires the use of a Windows script (PowerShell). To use this feature, follow [specific steps on the target device to create the service](/platform/user-guide/remote-actions/getting-started-with-remote-actions/managing-remote-actions/running-remote-actions-as-a-service-on-server-devices-windows-only.md). In the service name field, you need to specify the value of the `--service-name` parameter used during service setup.

Set the time-out for the script (in seconds). If the remote action cannot complete its action within the allotted time the system will terminate the script.

Refer to the in-product documentation for more information. You can find it in the side panel menu.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.nexthink.com/platform/user-guide/remote-actions/getting-started-with-remote-actions/creating-remote-actions.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
