MikroTik scripts: RouterBOARD firmware auto upgrade

Script to automatically upgrade the firmware (bootloader) of MikroTik after updating the version of RouterOS, to match the version of MikroTik RouterOS and the RouterBOARD bootloader.

Previously, I had to manually upgrade the RouterBOARD bootloader version, after updating the RouterOS version, this required additional time and attention when there were a lot of MikroTik devices. I wrote a script to automate this process.

Other languages:


The script runs 3 minutes later (180 seconds delay) after booting the MikroTik device. The used RouterBOARD firmware version (current-firmware) and the RouterBOARD version offered for upgrade (upgrade-firmware) are compared. If the versions do not match, the MikroTik device downloads the updated version of the RouterBOARD firmware and reboots the device after installing the new firmware version.

✏️ Note: check that after the specified pause time before the script starts, the Internet will really have time to connect or increase the delay before the script runs.

Create script (manually)

This script should run as soon as the device boots, so we create the script in the task scheduler, not in the script store.


[System] - [Scheduler] - [+]

Script Data

Name: AutoUpgradeFirmware
Start Time: startup
Policy: read, policy, reboot, write.


:delay 180s;
:if ([get current-firmware] != [get upgrade-firmware]) do={
MikroTik RouterBOARD firmware auto upgrade script

Create script (automatically)

/system scheduler
add name=AutoUpgradeFirmware on-event=":delay 180s;\r\
    \n:if ([get current-firmware] != [get upgrade-firmware]) do={\r\
    \n    upgrade;\r\
    \n    /system/reboot;\r\
    \n    }" policy=reboot,read,write,policy start-time=startup

Now the firmware version of the device (bootloader) is always the same as the RouterOS version, and I don’t have to spend time manually updating the firmware.

Script tested: RouterOS v7

? The script for automatically updating the firmware of a MikroTik device when the installed RouterOS version is changed was discussed in this article. I hope you can now automate the task of upgrading RouterOS and device bootloader version. However, if you encounter any problems while setting up the script, feel free to write in the comments. I will try to help.

1 thought on “MikroTik scripts: RouterBOARD firmware auto upgrade”

Leave a Comment