+ Post New Thread
Results 1 to 4 of 4
Scripts Thread, Automating Telnet Sessions in Coding and Web Development; I am a very lazy person and like to find ways to make my job simpler. I often have to ...
  1. #1


    Join Date
    Sep 2009
    Posts
    565
    Thank Post
    13
    Thanked 55 Times in 34 Posts
    Rep Power
    223

    Automating Telnet Sessions

    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:

    Code:
    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?

  2. #2
    british_government's Avatar
    Join Date
    Feb 2009
    Posts
    160
    Thank Post
    24
    Thanked 20 Times in 15 Posts
    Rep Power
    36
    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

  3. #3

    unixman_again's Avatar
    Join Date
    Nov 2011
    Posts
    678
    Thank Post
    26
    Thanked 136 Times in 103 Posts
    Rep Power
    134
    I've always used Expect for this sort of thing.

  4. #4


    Join Date
    Sep 2009
    Posts
    565
    Thank Post
    13
    Thanked 55 Times in 34 Posts
    Rep Power
    223
    C# is a definite nono for me. not a clue how to do anything in it!!

    I'll have a look at expect. cheers

SHARE:
+ Post New Thread

Similar Threads

  1. Telnet 2.0 ?
    By dagza in forum Jokes/Interweb Things
    Replies: 6
    Last Post: 12th July 2006, 10:08 AM
  2. Automate pinging on all devices
    By Cyber-Dude in forum Scripts
    Replies: 7
    Last Post: 22nd May 2006, 07:08 PM
  3. RDP - current sessions notification
    By pete in forum Windows
    Replies: 3
    Last Post: 22nd May 2006, 02:32 PM
  4. Windows Automated Installation Kit (WAIK) User's Guide
    By tosca925 in forum Windows Vista
    Replies: 0
    Last Post: 17th February 2006, 08:26 PM
  5. Automated Printer Server Migration
    By Dos_Box in forum How do you do....it?
    Replies: 1
    Last Post: 5th September 2005, 08:10 AM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •