Running commands
Send one set of commands to selected devices and follow progress and output together.
This page is the detail. If you have not run anything yet, start with Getting started.
Choose the right option#
There are four kinds of connection and five options, because the one WinBox uses offers two ways of delivering a script. They can do different things and are not interchangeable.
| Option | RouterOS | How it gets there | Longest script |
|---|---|---|---|
| 8291, line by line (default) | 6.x / 7.x | Typed in one line at a time as if you were at the terminal; the device's own prompt says when a line is done | 256 KiB |
| 8291, all in one go | 6.x / 7.x | The whole lot runs together; the screen echoes back more slowly for long scripts | 24 KiB |
| SSH (optional) | 6.x / 7.x | The whole thing is sent over SSH and run | 60 KiB |
| API (optional) | 7.x only | The whole thing is handed to the device as a string to run | 60 KiB |
| REST (optional) | 7.x only | The whole thing is sent through the device's web interface channel | 60 KiB |
When to use which#
- Line by line is the default and the right answer most of the time. It lets you send the most, and it
works on both RouterOS generations.
- All in one go is what you need when a script declares its own variables. Feeding a terminal one line at
a time means a variable declared with :local does not survive past its own line — that follows from the delivery method, not from anything the application left out.
- SSH is useful where 8291 is blocked but SSH is not. It needs
/ip service sshon at the device. - API / REST are for environments already standardised on them. Both are RouterOS 7.x only for running
commands, and REST also needs /ip service www or www-ssl.
Write the commands#
The box is plain text, with a counter beside it showing how much you have used against this option's limit. The history keeps what you ran before, and the whole lot can be saved to a file and called back, so a routine check does not have to be retyped.
Read-only commands to start with:
/system resource print
/interface ethernet print where running
/ip address printCommands that change the device are your call on your own equipment. Two habits worth keeping:
- Run the matching query command first, on the same set of devices, so you know exactly what you are about to
change.
- Be careful with anything that could cut the very path you are sending it over — firewall rules, disabling an
interface, changing an address. The application cannot undo those, and neither can a connection that has just dropped.
How many at once, and how long each gets#
Concurrency is how many devices are worked on at the same time. Per-device timeout is how long any one device gets before it is given up on.
- You can go up to 100. Above the recommended 20, the field says so — without stopping you.
- Turning it up is not automatically faster. The devices themselves, the network in between and your own
machine can each become the bottleneck first.
- The timeout is counted per device, so one slow device does not eat into everyone else's time.
It asks before it sends#
Pressing Run selected does not send anything yet. A confirmation appears first, showing what is about to run and on how many devices. Nothing reaches a device because your hand slipped on the mouse.
Reading results#
Results appear one row per device in 3. Review results, with a status, how long it took and what came back. Only this round's devices are listed.
| Status | Meaning |
|---|---|
| Running | Still going. |
| Completed | The device reached the end of your commands. |
| Connection failed | It never connected. Nothing was sent. |
| Uncertain | The commands were sent, then the connection dropped or the run was cancelled. |
| Cancelled | You stopped the run. |
What cancelling does#
Stop cancels the run. What that actually means depends on how you are connected:
- Over 8291, cancelling stops that connection.
- Over API, SSH and REST, cancelling only stops this end waiting. It cannot promise the command
stopped at the device — the device may well finish what it was already given.
Either way, devices whose commands had already been sent are reported as uncertain, not as failures, and the application does not re-send on its own. A silent retry is exactly how one command becomes two.
After the run#
- Stash problem devices collects everything that had trouble into one saved group.
- Retry problem devices re-runs against just those.
- Copy output and Copy status summary put the results on the clipboard.
Next#
- Port monitoring — watch what is actually happening on the wire.
- Troubleshooting — when a device does not answer.