Can someone help me with Secure CRT VBscript

Anything VBScript-related, including Windows Script Host, WMI, ADSI, and more.
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.
This topic is 12 years and 1 month old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
mybox65
Posts: 1
Last visit: Thu Feb 02, 2012 1:10 am

Can someone help me with Secure CRT VBscript

Post by mybox65 »

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
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Can someone help me with Secure CRT VBscript

Post by jvierra »

That is not VBScript.

Where did you get that code. There is not way it will execute in a file with a VBS extension.
This topic is 12 years and 1 month old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked