# Remote Actions NQL capabilities

This list of NQL examples is designed to help you execute remote actions on demand. Go through the queries below and pick the one most similar to your use case, copy it, and adjust it accordingly.

<details>

<summary>Return all devices.</summary>

```
devices
```

</details>

<details>

<summary>Return a specific device.</summary>

```
devices 
| where name == "Device-Name"
| list name
```

</details>

<details>

<summary>Return all remote action executions in the system and sort them from the newest to the oldest.</summary>

```
remote_action.executions
|list remote_action.name, device.name, trigger_method ,time, status, status_details, outputs
|sort time desc
```

</details>

<details>

<summary>Return executions of a specific remote action in the last hour sorted from newest to oldest.</summary>

Replace `Remote-Action-Name` with the name of the remote action you are looking for.

```
remote_action.executions during past 60min
|where remote_action.name == "Remote-Action-Name"
|list remote_action.name, device.name, trigger_method, time, status, status_details, outputs
|sort time desc
```

</details>

<details>

<summary>Return remote action executions for a specific device in the last hour sorted from newest to oldest.</summary>

Replace `Device-Name` with the name of the device you are looking for.

```
remote_action.executions during past 60min
|where device.name == "Device-Name" 
|list remote_action.name, device.name, trigger_method, time, status, status_details, outputs
|sort time desc
```

</details>

<details>

<summary>Get the values from the last successful execution of a remote action, for example: #Get_Battery_Status.</summary>

```
devices during past 7d
| list remote_action.get_battery_status.execution.outputs.BatteryHealth
```

</details>

<details>

<summary>Return the battery health status of the windows device.</summary>

```
remote_action.get_battery_status.executions 
| list device.name, outputs.BatteryHealth
```

</details>

<details>

<summary>Return all triggered remote actions for a specific internal source.</summary>

```
remote_action.executions during past 7d
| where internal_source == "Amplify"
| list remote_action.name , device.name , time , trigger_method , status
```

</details>

<details>

<summary>Return all triggered remote actions for a specific trigger method.</summary>

```
remote_action.executions during past 7d
| where trigger_method == manual
| list remote_action.name , device.name , time , trigger_method , status
```

</details>


---

# 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/remote-actions-nql-examples.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.
