LeightonJames Posted September 17, 2012 Posted September 17, 2012 I am a very lazy person and like to find ways to make my job simpler. I often have to reconfigure Wireless Access Points and only need to change some info for each AP. The bits i need to change are password, SSID, WPA Key, AP name and IP Address. I have recently discovered that the AP's we use support the use of telnet to change ALL these. I looked into ways of automating the process using WshShell.SendKeys and a script based loosely on this: set oShell = CreateObject("WScript.Shell") oShell.run("Telnet") WScript.Sleep 1000 oShell.SendKeys("Open 127.0.0.1 23") WScript.Sleep 1000 oShell.SendKeys("{Enter}") WScript.Sleep 1000 oShell.SendKeys("n") WScript.Sleep 1000 oShell.SendKeys("{Enter}") WScript.Sleep 1000 oShell.SendKeys"MyName" WScript.Sleep 1000 oShell.SendKeys("{Enter}") WScript.Sleep 1000 oShell.SendKeys("MyPassword") WScript.Sleep 1000 oShell.SendKeys("{Enter}") WScript.Sleep 1000 oShell.SendKeys("MyCommand") WScript.Sleep 1000 oShell.SendKeys("{Enter}") WScript.Sleep 1000 What i want to do though it have a msgbox pop up and ask for the ip address of the AP, the new SSID and the new IP. The rest of the info is standardised across the board. The pop up works ok and i can type the ip address in and then click ok, the rest of the script runs ok until it gets to the ip address. Where the ip is hardcoded in above my script reads: oShell.Sendkeys "o " & ip <-- the ip variable had already been declared prior to this and it is the input of the message box What happens is that the output is this: Welcome to Microsoft Telnet Client Escape Character is 'CTRL+]' Microsoft Telnet> o ( to ) usage: open hostname port Microsoft Telnet> admin Invalid Command. type ?/help for help Microsoft Telnet> so where the ip is supposed to be i get nothing Anyone able to help me?
british_government Posted September 17, 2012 Posted September 17, 2012 Depending on how deep you want to go, I would write something in C#. C# 2.0* and Telnet - Not As Painful As It Sounds
unixman_again Posted September 17, 2012 Posted September 17, 2012 I've always used Expect for this sort of thing.
LeightonJames Posted September 17, 2012 Author Posted September 17, 2012 C# is a definite nono for me. not a clue how to do anything in it!! I'll have a look at expect. cheers
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now