I had a client this past christmas who wanted to setup his router to reboot every couple of hours.
Its an old netgear router meaning it has no telnet options natively built in.
I gave him the rundown…
1. He could goto walmart and buy a timer smallest shutdown time is 30 minutes.
2. He could by router specifically designed for this reboot process smallest shutdown time is 10 seconds
About this time, he told me he needed a script that shuts down his router and reboots it… He doesn’t care about shutdown time. He just needs something basic and asked if I could cobble something together. You know me, I said sure.
Below is what I did…
Here is what he needed a script that shuts down his router and that he can call from windows scheduler.
Ok… So needs a batch script.
First things first… I had to figure out how to reboot his router from command prompt…
I figured out real quick his router had no such options so I went search in the interweb and I found… telnetenable for linux and for windows.
Next figure out how it works…
For this particular netgear router… you have to load telnet with telnet enable… then reboot it. no loading… no option to reboot… ok now how do you load it…
You need to run
telnetenable 192.168.1.50 00AABBCCDD00 Gearguy Geardog
from the command prompt
so if its in the c driver and in folder g then you would have to go into command prompt change the folder to g and then type in your command
telnetenable you need…
the ip address is the ip address of your router… typically your gateway
the all caps… is your MAC address
Gearguy Geardog you need…
ok with that loaded you can reboot and it will reboot…
now how do we script loaded telnet… ok now you need… telnet scripting tool
how do you use it well you need to input the reboot command into it via a batch script…
here is the implimentation for the reboot command. tst10.exe /r:reboot.txt /m
reboot.txt contains the following
Next you are going to need to a bat file to call telnetenable
lets call it reboot.bat
it contains the following
start telnetenable 192.168.1.50 00AABBCCDD00 Gearguy Geardog
NETSH diag Ping Loopback
NETSH diag Ping Loopback
tst10.exe /r:reboot.txt /m
lets say you needed to show a message on the screen… THE ROUTER WILL REBOOT IN 60 SECONDS…. PLEASE SAVE ALL WORK…
you would place text in a text file… say message.txt and you would place the following command below
start notepad message.txt
‘NETSH diag Ping Loopback’ gives you a 5 second pause
Now remember folder g… in folder g put the telnetenable.exe, the tst10.exe, reboot.bat and reboot.txt, message.txt and any files associated with telnetenable and tst10.exe now for reboot.bat…create a shortcut and put it on the desktop… when you are ready… run it and you are done… am I forgetting something… oh yes… you need to schedule this…
scheduling tasks in windows xp
scheduling tasks in windows 7
Related External Links