Community discussions

MikroTik App
 
ipcsolutions
just joined
Topic Author
Posts: 5
Joined: Fri Aug 07, 2015 1:58 am

Get version number in variable

Thu Oct 07, 2021 8:39 am

Currently we can do the following in our script to create variable which holds the serial of the device:
:global serial [/system routerboard get serial-number]

However, we would like to set a variable which holds the version of the device for example:
:global serial [/system routerboard get version]
The above does not work...

I have tried doing the following:
:global version [/system resource print]
However, not only does it contain more information than what we need, when I print out the variable with
:put $version
it comes up with
input does not match any value of value-name
.

Any help would be much appreciated...
 
ConnyMercier
Forum Veteran
Forum Veteran
Posts: 725
Joined: Tue Dec 17, 2019 1:08 pm

Re: Get version number in variable

Thu Oct 07, 2021 9:46 am

Maybe this will help !
:global version ([/system resource print as-value] -> "version")
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 12008
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Get version number in variable

Thu Oct 07, 2021 2:49 pm

Do not use print on scripts, until command already exist for do the same on simpler way.

What exactly you want?

RouterOS version
:global rosver [/system resource get version] 

or RouterBOOT version?
:global rbootver [/system routerboard get current-firmware]
 
ipcsolutions
just joined
Topic Author
Posts: 5
Joined: Fri Aug 07, 2015 1:58 am

Re: Get version number in variable

Sat Oct 23, 2021 1:05 am

Thanks very much, both work well!

Who is online

Users browsing this forum: Kanzler, mhenriques, pav5, pmcsill and 103 guests