Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Automating a telnet session 1

Status
Not open for further replies.

AntiEarnie

Technical User
May 2, 2002
215
0
0
US
I'm trying to grab some interface statistics off one of our switches. I've tried a few methods so far and have had little luck. At first I thought I could use Exec in WScript.Shell. However when I tried that method I couldn't send any keystrokes to work through the menus. When I tried just using the sendkys command I can get to the section I want but I can't capture the output to parse out the statistics. Does anyone know how you can get VBscript to do this? Its really annoying since I used to have a number of perl scripts that did this stuff just fine.
 
I have had luck using a plain TCP socket as a "Telnet" connection to several small SMC routers, some older 3Com switches, and some really early Cisco stuff.

It also worked Ok to connect to some very old SCO Unix machines when I "dummied" things up a bit by sending out some canned option sequences and ignored and threw away some of those coming back from the Telnet daemon on those machines. This required snffing a manual Telnet session 1st however, to find out what I was going to get and what I was going to have to send.

Almost anything newer and/or bigger (several 'Nixs, mainframes, Windows Telnet) tries to get too fancy for this to work. They seem to require several back and forth "discussions" using those sequences that look like funny "y" characters and such... the FF FD and FF FA sequences shown in the capture up above in my previous post.

You may be ok with switches and routers, some of them still keep things simple, and basically use the socket pretty much as is... but I have run into so much trouble that every one seems to be an adventure.
 
Heh, I NEVER thought having this old hardware would be a boon... Thankfully the only critical stuff is on these old switches. I'll try it against a few of my newer switches here in a bit to try and track down the problem children.

I'll keep an eye out for a real scriptable telnet. Still have a few more I downloaded I have yet to test.
 
Thank you. This solutions have solved one of my problem.

Have Great 'n' Wonderful Day ...

Thanks & Regards,
Sankar.
 
I have tried piping StdIn to Telnet and it works. However when trying to pipe the StdOut of telnet to a file, telnet terminates as soon as it start up.

I think the problem is telnet check that the output is a Win32 console when it startup. I suspect WScript.Shell does not create such a console.

I am still looking for an alternate telnet program that can be scripted or used in a background without a user interface.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top