πŸ“Œ [Feature Request] Add Script Support in Winbox for Pre-Connection Tasks

Dear MikroTik Team,

I would like to suggest a new feature for the Winbox utility that could greatly enhance flexibility and automation: the ability to run a user-defined script before connecting to a MikroTik device.
:wrench: Suggested Feature:

An optional script field (per session or globally) in Winbox where users can define commands or scripts to be executed prior to initiating a connection to a router.
:white_check_mark: Use Cases:

Port Knocking Automation
Some administrators secure access to their MikroTik devices using port knocking. With this feature, Winbox could automate sending the correct knock sequence to temporarily open required management ports before attempting to connect.

Dynamic Environment Setup
In advanced setups, users might need to:

    Set up a specific VPN or tunnel before connecting.

    Modify routing rules.

    Define temporary environment variables.

    Trigger logging or alerts for connection auditing.

Multiple Device Profiles
Users managing multiple environments (home lab, enterprise, client routers) could tailor the pre-connection behavior depending on the device profile, improving both usability and security.

:light_bulb: Proposed Implementation:

Add a β€œPre-Connect Script” field in each Winbox session entry.

Support running:

    Windows batch (.bat)

    PowerShell

    Or even internal Winbox macros in the future.

A timeout and error-handling mechanism to abort the connection if the script fails or is interrupted.

This feature would be a small addition but provide enormous value to network administrators, especially those managing many remote or secured devices.

Thank you for considering this idea!

Best regards,
Tishri Clarin
Network Consultant & Software Developer

Or you could write those batch and PowerShell scripts right now and do what ever you want before having those scripts starting WinBox themselves, specifying router/account/session/workspace as command line parameters. Then those scripts can also do whatever cleaning up needed after WinBox returns.

Each session or has different rules, not possible using a script to execute before winbox. There are hundreds of sessions that have different rules to connect.

Well instead of managing the list of routers/switches in the badly conceived UI of WinBox, you just have your thousands of .bat/.ps1/.sh each customized for a device, and manage them with Explorer or whatever your favorite File Manager. I would argue that the file managers built to manage millions of hierarchical files & folders are better at that task than the single table on the home screen of WinBox.

Double click on a file and have WinBox logged in to that device. With custom script running before and after the call to start the WinBox instance.