#1
|
||||
|
||||
![]()
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? |
#2
|
|||
|
|||
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" objse.Log(True),True objSc.WaitForString "assword:" objSc.Send "sword" & vbCr objsc.WaitForString">" objsc.Send "sho ver | include IOS" & vbCr objsc.WaitForString">",1 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 IOSFile.Close() objse.Log(False) objSc.Synchronous = False objSE.Disconnect Else Set Tempfile = FSO.OpenTextFile("C:\NoConnect.txt",ForAppending, True) TempFile.writeline "Could Not Connect to " & IP TempFile.Close() End If Wend |
#3
|
||||
|
||||
![]()
This contains exactly what I need, and then some. Thanks a bunch!
|
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Display Modes | Rate This Thread |
|
|