The Perfect MikroTik Config Restore Script

The Perfect MikroTik Config Restore Script

Restoring config files on MikroTik routers have always been a pain. I set out to make the perfect config restore script for MikroTik routers.

Have your every tried to paste configuration commands into a MikroTik router? Yeah, it doesn’t work. As soon as the script adds an interface to a bridge or changes an IP you get disconnected and the rest of the script lines fail to restore.

Using the ‘run after reset‘ method is really the best way to restore a MikroTik router’s configuration but it has it’s own little caveats like editing the script first and adding a :delay 15s; line at the top.

After reboot, there is no clear indication if the import was successful or failed. While troubleshooting an error riddled backup I had the idea of introducing an audible beep before and after the import process. This lead me to develop this script.

This script is designed to restore plain-text, export files created using the following command.

I personally use the following export command to backup my routers. I find it easier to read and every line of the script is independent so copy and paste just works.


  • Introduces a delay – This allows time for the router’s interfaces to initialize before running the import script.
  • Audible prompts – Before and after beep sequences to tell you if the import was successful.
  • Logging to disk – you can inspect perfectrestore.log.0.txt to see if the import was successful. This is useful if your router does not have a builtin speaker (some models don’t).

How to use this script

Time needed: 1 minute.

WinBox Method

  1. Upload perfectrestore.rsc to your router’s flash folder

  2. Rename your backup file backup.rsc and upload it to the router’s flash folder

  3. Click “System | Reset Configuration” in Winbox

  4. Check the box “No Default Configuration” and choose flash/perfectrestore.rsc from the “Run After Reset” dropdown

  5. Click the [Reset Configuration] button

The router will erase the existing configuration, reboot and execute the perfectrestore script. The script will introduce the proper delay, play the beginning beeps, then /import flash/backup.rsc. If the import completes without error you will here the success beep sequence.

CLI Method

  1. Upload perfectrestore.rsc and backup.rsc to your router’s flash folder via scp or ftp
  2. Issue the following command on the router.

perfectrestore.rsc script download

Github Project

I hope this script makes MikroTik Backups and Restores easier for you.
Have questions? Leave a comment below!!!

4 Replies to “The Perfect MikroTik Config Restore Script”

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.