> For the complete documentation index, see [llms.txt](https://wiki.datadike.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://wiki.datadike.com/sonar/administration/automation/bulk-actions.md). Agents can also search and read this documentation through its [MCP server](https://wiki.datadike.com/~gitbook/mcp).

# Run actions across many devices

Send one command, one script or one patch action to every device of a client, a site, a hand-picked list or your whole scope, filtered by operating system and device type.

## What this is and when to use it

The three bulk tools in the **Tools** menu send the same action to many devices in one step:

| Tool                              | Dialog title              | What it sends                                                                                              |
| --------------------------------- | ------------------------- | ---------------------------------------------------------------------------------------------------------- |
| **Tools › Bulk Command**          | **Run Bulk Command**      | One command line                                                                                           |
| **Tools › Bulk Script**           | **Run Bulk Script**       | One script from the [script library](https://wiki.datadike.com/sonar/administration/automation/scripts.md) |
| **Tools › Bulk Patch Management** | **Bulk Patch Management** | A Windows Update scan, or the installation of approved updates                                             |

Use them for fleet-wide one-off work: collecting a value from every workstation of a client, applying a fix to one site, or forcing a patch scan before a maintenance window. For work that must repeat, use [automated tasks](https://wiki.datadike.com/sonar/administration/automation/automated-tasks.md) instead.

## Before you start

* A role with **Run Bulk Operations** (group **System** of **Admin Center › Roles**), plus the permission of the action itself: **Send Command** for **Bulk Command**, **Run Scripts** for **Bulk Script**, **Manage Windows Updates** for **Bulk Patch Management**. The menu entry and the **Run** button stay disabled without both.
* The target only ever includes devices your role can see. A client or site outside your scope is refused.
* For **Bulk Script**, the script must exist in **Management › Scripts**.
* Devices must be online when you click **Run**. The action is sent once, at that moment. A device that is offline does not receive it and does not run it later when it reconnects.

## Steps

1. Open the **Tools** menu in the header (gear icon) and choose **Bulk Command**, **Bulk Script** or **Bulk Patch Management**. The dialog opens as a panel on the right.
2. Under **Choose Target**, pick **Client**, **Site**, **Selected Agents** or **All**.
3. Pick the client in **Select Client**, the site in **Select Site**, or the devices in **Select Agents**. **All** needs no selection: it means every device your role can see.
4. Under **Agent OS**, choose the platform. **Bulk Command** offers **Windows**, **Linux** and **macOS**; **Bulk Script** also offers **All**; **Bulk Patch Management** is Windows only.
5. Under **Agent Type**, choose **All**, **Servers** or **Workstations**. This filter is not shown for **Selected Agents**.
6. Fill the action:
   * **Bulk Command**: choose the **Shell** (**CMD** or **Powershell** for Windows, **Bash** or **Custom** for Linux and macOS) and type the command in **Command**.
   * **Bulk Script**: choose the script in **Select Script**, then review **Script Arguments** and **Environment vars**, filled with the script's defaults. Tick **Save results to Custom Field** (and choose the field in **Select custom field**) or **Save results to Agent Note** if the output must be kept on each device.
   * **Bulk Patch Management**: choose **Scan** or **Install** under **Action**.
7. For commands and scripts on Windows, tick **Run As User** under **Privileged Execution** if the action must run as the logged-in user.
8. Check **Timeout (seconds)** for commands and scripts.
9. Click **Run**.

The **Bulk Actions** button of **Devices › Windows Updates** opens the same **Bulk Patch Management** dialog.

## What you should see

The panel closes and a confirmation states how many devices were selected by the target and filters:

* `Command will now be run on <n> agents. Check the History tab on the agent to view the results.`
* `<script> will now be run on <n> agents. Check the History tab on the agent to view the results.`
* `Patch status scan will now run on <n> agents`
* `Pending updates will now be installed on <n> agents`

The number is the count of devices matched when you clicked **Run**, online or not. Each device runs the action on its own and reports back when it finishes.

## How to verify it worked

1. Open **Reports & Audits › Audits**. The run is recorded as **Bulk Action** with a message such as `<user> executed bulk command on all agents within client: CLIENT-A` or `<user> executed bulk script: <script> on multiple agents`. The recorded details include the full request and, for **Selected Agents**, the device names.
2. For commands and scripts, open a few target devices and their **HISTORY** tab. Each device has a **Cmd Run** or **Script Run** line for the run, with the output behind **Output** once the device has reported. There is one line per device; results are read device by device.
3. For **Save results to Custom Field** or **Save results to Agent Note**, check the custom field or the **NOTES** tab of a target device.
4. For patch actions, open the device's **UPDATES** tab or **Devices › Windows Updates** after the devices report their scan or installation results.

A **History** line that stays at `No output is available yet` belongs to a device that did not run the action, typically because it was offline. Run the action again for that device once it is online.

## Common errors

| Symptom                                                                                     | Cause                                                                                  | Fix                                                                                        |
| ------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------ |
| The **Tools** entry or **Run** is disabled with `You don't have permission for this action` | The role lacks **Run Bulk Operations** or the action's own permission                  | Add both permissions to the role                                                           |
| `Must select at least 1 agent`                                                              | **Selected Agents** with an empty list                                                 | Pick at least one device                                                                   |
| `No agents were found meeting the selected criteria`                                        | The target and the **Agent OS** / **Agent Type** filters match no device in your scope | Widen the filters, or check that the client or site has devices of that platform           |
| A permission error when choosing a client or site                                           | The client or site is outside your role's scope                                        | Choose a target your role covers                                                           |
| Some devices never show a result                                                            | They were offline when the action was sent                                             | Run it again for those devices when they are online                                        |
| A script is missing from **Select Script**                                                  | It does not support the chosen **Agent OS**, or it is hidden                           | Change **Agent OS** to the script's platform or **All**, or show the script in the library |

## Field reference

| Field                                       | Tool            | What it does                                                                                                                                                                                                                   | Accepted values                                                                               | Default                        |
| ------------------------------------------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------- | ------------------------------ |
| Choose Target                               | All             | Which devices the action is sent to                                                                                                                                                                                            | **Client**, **Site**, **Selected Agents**, **All**                                            | **Client**                     |
| Select Client / Select Site / Select Agents | All             | The client, site or devices of the target                                                                                                                                                                                      | Items in your scope                                                                           | None. Required for that target |
| Agent OS                                    | All             | Keeps only devices of this platform                                                                                                                                                                                            | Command: **Windows**, **Linux**, **macOS**. Script: the same plus **All**. Patch: **Windows** | **Windows**                    |
| Agent Type                                  | All             | Keeps only servers or only workstations. Hidden for **Selected Agents**                                                                                                                                                        | **All**, **Servers**, **Workstations**                                                        | **All**                        |
| Shell                                       | Command         | Interpreter                                                                                                                                                                                                                    | Windows: **CMD**, **Powershell**. Linux and macOS: **Bash**, **Custom**                       | **CMD** or **Bash**            |
| Custom shell                                | Command         | Interpreter path for **Custom**                                                                                                                                                                                                | Absolute path, for example `/usr/bin/python3`                                                 | Empty                          |
| Command                                     | Command         | The command line                                                                                                                                                                                                               | Text                                                                                          | Empty                          |
| Select Script                               | Script          | The library script                                                                                                                                                                                                             | Scripts supporting the chosen platform                                                        | None                           |
| Script Arguments                            | Script          | Arguments for every device. Variables are resolved per device                                                                                                                                                                  | Text, with [script variables](https://wiki.datadike.com/sonar/reference/script-variables.md)  | The script's defaults          |
| Environment vars                            | Script          | Environment variables, as `KEY=VALUE`                                                                                                                                                                                          | Text, with script variables                                                                   | The script's defaults          |
| Save results to Custom Field                | Script          | Writes the last line of each device's output to a custom field, or the whole output with **Save all output**                                                                                                                   | On or off, plus a device, site or client custom field                                         | Off                            |
| Save results to Agent Note                  | Script          | Saves each device's output as a note on that device                                                                                                                                                                            | On or off                                                                                     | Off                            |
| Run As User                                 | Command, Script | Windows only. Runs as the logged-in user; if none is logged in, runs as SYSTEM                                                                                                                                                 | On or off                                                                                     | Off                            |
| Timeout (seconds)                           | Command, Script | Maximum run time on each device                                                                                                                                                                                                | Whole number of seconds                                                                       | 30, or the script's default    |
| Action                                      | Patch           | **Scan** asks each device for its update status. **Install** approves updates according to the device's [patch policy](https://wiki.datadike.com/sonar/administration/patching/patch-policy.md) and installs the approved ones | **Scan**, **Install**                                                                         | **Scan**                       |

## Related pages

* [Run a command or a script on a device](https://wiki.datadike.com/sonar/administration/automation/run-commands-and-scripts.md)
* [Script library](https://wiki.datadike.com/sonar/administration/automation/scripts.md)
* [Windows Updates across the fleet](https://wiki.datadike.com/sonar/administration/patching/windows-updates.md)
* [Script variables](https://wiki.datadike.com/sonar/reference/script-variables.md)
* [Audit trail](https://wiki.datadike.com/sonar/administration/audit/audit-trail.md)
