Welcome to the VanDyke Software Forums

Join the discussion today!

Go Back   VanDyke Software Forums > Scripting


Closed Thread
Thread Tools Rate Thread Display Modes
Old 12-28-2004, 11:45 AM
sveillon's Avatar
sveillon sveillon is offline
Registered User
Join Date: Dec 2004
Location: Los Angeles
Posts: 3
Question Telnet login script

Does anyone have a simple telnet login script I can use as a base to edit? I simply want to have it auto-login. This is to a cisco router, so will need to send the initial CR, wait for "sword:", send the password, then send "en" (CR), and finally wait for "sword:" again and send the enable password.

The help file doesn't address this, probably because the functionality is there without a script. However, I have about 100 of these to configure and don't want to have to fill out that thing every time when they are all the same. I'd rather just browse for the script for each of them.

Can anyone help me out?

BTW, what ever happened to simple text scripts?
Old 12-28-2004, 12:25 PM
wasodg2 wasodg2 is offline
Registered User
Join Date: Dec 2004
Location: Spokane, WAshington
Posts: 16
I'm no expert and I am just learning the scripting objects here but I did write this script to get the IOS versions off of Cisco 2900 and 2950 Switches, maybe you can change it to work for your routers as well?

It reads IP address from a text file called C:\oneIP.txt, connects to each one in the file and places the IOS information into anotehr text file called C:\IOS.txt, any switch it cannot connect to is located in another text file called C:\NoConnect.txt.

# $language = "VBScript"
# $interface = "1.0"
Const ForReading = 1
Const ForWriting = 2
Const ForAppending = 8
Set FSO = CreateObject("scripting.filesystemobject")
Set Shell = CreateObject("WScript.Shell")
Set SwitchIP = FSO.opentextfile("C:\oneIP.txt", ForReading, False)
Set objDictionary = CreateObject("Scripting.Dictionary")
Set objSc = crt.Screen
Set objD = crt.Dialog
Set objSe = crt.Session
Set objW = crt.Window

objsc.Synchronous = True

While Not SwitchIP.atEndOfStream
IP = SwitchIP.Readline()

' connect To host On port 23 (the default telnet port)
'On Error Resume Next
objse.Connect "/TELNET "&IP&" 23"

If ( objse.connected ) Then
objse.logfilename = "c:\crt.Log"
objSc.WaitForString "assword:"
objSc.Send "sword" & vbCr
objsc.Send "sho ver | include IOS" & vbCr
SelectRow = objSc.CurrentRow - 1
IOSline = objSc.Get(SelectRow, 1, SelectRow, 132 )
'objD.Messagebox IOSline
Set IOSfile = FSO.OpenTextFile("C:\IOS.txt",ForAppending, True)
IOSFile.writeline IP & " " & IOSline
objSc.Synchronous = False


Set Tempfile = FSO.OpenTextFile("C:\NoConnect.txt",ForAppending, True)
TempFile.writeline "Could Not Connect to " & IP
End If
Old 12-28-2004, 12:45 PM
sveillon's Avatar
sveillon sveillon is offline
Registered User
Join Date: Dec 2004
Location: Los Angeles
Posts: 3
Thumbs up Thanks!

This contains exactly what I need, and then some. Thanks a bunch!
Closed Thread

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT -6. The time now is 02:35 AM.