Exported configurations are useless for importing

While I typed the title of this topic, I got suggestions with similar threads and read them so I already got an idea of the answers I may get.

I am upgrading a small office from a CRS109-8G-1S-2HnD to a hAP ax2.
I need to copy the configuration to the new router, so I am exporting the config with:
export file=filename show-sensitive

and then tried to import it on the new router, blank with the default configuration removed, but it gets stuck with errors like:

expected end of command (line 1 column 71)

failure: name can't repeat!

or commands that are not even in a format the new router can understand.
You may say there may be differences in the routerOS version between the 2 devices, but I am also using my own Mikrotik router at home as a sandbox to practice, and if I export the config, reset my router without a default configuration and try to import the generated .rsc file from the same router and same routerOS version, the script is still useless throwing the expected end of command errors right from the very first lines.

So what I understand reading previous posts, is that the generated config files are just a guide and I will be stuck manually punching line by line, remove all backslashes and have to learn the correct syntax of every command to make it work?

The issue is, I need to do this remotely. One of the guys in the office is helping me to plug/unplug wires from the router, reboot it and move it around, but I need to stitch the script together so it will work in the first shot, without wasting his time reseting the new router from scratch every time the script fails in the middle of the process, that is why I am trying to use my own as a sandbox.

If I post the current config, and tell you what RouterOS version is installed on the new one, could you guys help me figure how to fix the script so it will work?

Hi

It's known inconvienience of ROS.
Start with reading some posts/threads on it you can find on forum

I suggest using terse option during export as it makes al commans "complete". You do not need to be in the proper context to add eg. interface as command is not "relative" but "explicit" with all needed info.

When you import line by line or block by block of commands then you need to sort them somehow to import lines that use "named entities" (eg. interface lists) after importing objects that are members of that "entities"

It needs some training but if you get accustomed to it, it goes quite fast.

Thank you a lot for the suggestion using the terse option, I did not know about that. Now the exported file is a lot easier to read.
I will try using my router as a sandbox and check the lines where the script get stuck.

Another question... the router has these keys:

https://i.imgur.com/CWnqm3v.png

I remember years ago there was an attempt to use OpenVPN but is not used anymore, but now they use L2TP for the office VPN. How can I find out whether these keys are needed for anything else in the router.. should i also move those to the new one?

Do not use external hosting for pictures/screenshots. Just paste them into the edit window.

simply

when you export config to txt file, try text search for these cert names
for example

/interface ovpn-server server
add certificate=server ....

server is the cert name

The exported script is about 100 lines of commands. Importing the .rsc config using the import command fails, but I tested copying and pasting line by line and it worked fine.
My guess is when the script reaches the part that sets the bridged ethernet ports (about 20 lines down from the beggining), the router restarts immediately so that makes the script to fail and the process is incomplete. I will run another test commenting out those lines to see if my theory is right, then i can finish setting up the bridge manually.