Script to reboot wireless controller WM3400

  • 0
  • 1
  • Question
  • Updated 2 years ago
  • Answered
WM3400 v5.5.5.0-018R
Using Windows 7 machine

I'm looking to create a basic script that will allow me to reboot a wireless controller through SSH.  I use PuTTY/Plink and have been able to remote in (via script) with no issue.  I am however a bit lost at how to get the device into privileged mode and use the reload command through a script.  I'm hoping you have had this issue come up before and could guide me towards the light. 
Photo of Sean Tutor

Sean Tutor

  • 568 Points 500 badge 2x thumb

Posted 2 years ago

  • 0
  • 1
Photo of Christopher Davis

Christopher Davis

  • 366 Points 250 badge 2x thumb

What script are you currently using to remote in Sean?

Photo of Sean Tutor

Sean Tutor

  • 568 Points 500 badge 2x thumb
Currently it's a batch file that looks like this:
start C:\Users\Seant\plink.exe -ssh  username@x.x.x.x -pw genericpassword.  

This gets me access to the Controller.  I'm having difficulty getting the commands scripted after this. (Mostly because I've never gone very heavily into scripting)
This is all I need it to enter:

en
restart
Photo of Christopher Davis

Christopher Davis

  • 366 Points 250 badge 2x thumb
I haven't used a batch before to do this.  Since it appears you are using plink however, something like this could work.  Create a text file with the necessary commands and save it as commands.txt or something.

-m  c:\path\commands.txt > output.txt                <--------------then add that to the end of your current batch I believe.

Additionally http://the.earth.li/~sgtatham/putty/0.67/htmldoc/Chapter7.html this is a helpful link for using plink.

Let me know how it goes, or if you need anything else.
Photo of Sean Tutor

Sean Tutor

  • 568 Points 500 badge 2x thumb
I ended up downloading AutoITv3 to get this done because I don't think a normal batch file could do what I wanted.  I created a folder and called it Reboot_Wireless.  In that file I have a batch program and AU3 script file. 

The batch file gets called on by the script and looks like this

rem Open Tunnel
start C:\Users\Seant\plink.exe -ssh  enterusername@x.x.x.x -pw yourpassword

I named the batch example.bat

The script I wrote looks like this.

#RequireAdmin
Run (@ScriptDir & '\example.bat')
Sleep (20000)
Send("en{ENTER}")
sleep(3000)
Send("reload{ENTER}")
Sleep(3000)
Send("y{ENTER}")
Sleep(3000)
Send("y{ENTER}")
Sleep(300)


I named this rebootexample.au3

From here I set task scheduler to reboot my controllers once a week by launching rebootexample.au3

I hope this helps anyone that wishes to use a script to reboot their controllers or maybe do something else.