omberli
October 19, 2018, 10:19pm
1
I’m setting up a customer’s wifi system with one or two access points. They want to change the wifi password once every month, They want to do this by running a batch file or a simple script - maybe enter the new password as a parameter. Is this possible in RouterOS (maybe with winbox?)
oberli
td32
October 19, 2018, 11:57pm
2
here you can try this ugly solution
1- create a batch file containing the following
::@echo off
SET NewWifiPass=
SET /p NewWifiPass= NewWifiPass(min 8 char long):
copy /Y changewifi.txt changewifi.temp.txt
sed -i s/OldWIFIPASS/%NewWifiPass%/g changewifi.txt
START /W putty.exe -ssh mikrotikUSER@mikrotikIP -pw mikrotikPASSWORD -m changewifi.txt
copy /Y changewifi.temp.txt changewifi.txt
replace your mikrotik login info in the code above
2- create the following file named changewifi.txt containing
interface wireless security-profiles
set [ find default=yes ] wpa2-pre-shared-key=OldWIFIPASS
3- copy sed in the same folder (you can find sed for windows inside UnxUtils)
4- copy putty in the same folder
avoid inserting special chars in the password because sed will not work uncles they are escaped