I just created a script for automatically connect to hosts, However I do not know how to create a TXT file to store the failure connection, Please see below , I do appreciate your help !!
# $language = "VBScript"
# $interface = "1.0"
Sub Main
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Dim fso,file1,line,str1,params
Set fso = CreateObject("Scripting.FileSystemObject")
Set file1 = fso.OpenTextFile("e:SWbackuplist.txt",Forreading, False) ---------->list.txt is my IP address list
crt.Screen.Synchronous = True
DO While file1.AtEndOfStream <> True
line = file1.ReadLine
params = Split (line)
crt.session.Log(true)
crt.Session.Connect "/TELNET " & params(0)
<<<<Here, I just want to creat a txt file to store unreachable connection and if the connection doesn't work , it can jump to connect another IP>>>>
crt.Screen.WaitForString "Username:"
crt.Screen.Send params(1) & vbcr
crt.Screen.WaitForString "Password:"
crt.Screen.Send params(2) & vbcr
crt.Screen.waitForString "#"
str1 = "show run"
crt.Screen.Send str1 & vbcr
crt.Screen.WaitForString " --More-- "
crt.Screen.Send " " & vbcr
crt.Screen.waitForString "!" & vbcrlf & "end",1
crt.Session.Disconnect
loop
crt.Screen.Synchronous = False
End Sub
Can someone help me with Secure CRT VBscript
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.