View Single Post
  #5  
Old 10-10-2008, 10:50 AM
nxg nxg is offline
Registered User
 
Join Date: Sep 2008
Posts: 8
I get a Connection Failed at line 32 message appear after a moment, though it does open a window... The sessionlist.txt file just contains one IP address on the first line at the moment.

#$language = "VBScript"
#$interface = "1.0"

Sub Main

Const username = "xxxxx" ' Username to use for login
Const password = "xxxxx" ' Password for corresponding user

Const DEVICE_FILE_PATH = "C:\Program Files\VanDyke Software\SecureCRT\Scripts\sessionlist.txt"

Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")

Dim fil
Set fil = fso.OpenTextFile(DEVICE_FILE_PATH)

Dim ip
Dim cnxnString

'On Error Resume Next

While Not fil.AtEndOfStream

ip = fil.ReadLine

cnxnString = "/SSH2 /L " & username & " /PASSWORD " & password & ip & " /AcceptHostKeys"

' Connect

crt.Screen.Synchronous = True

crt.Session.Connect cnxnString

crt.Screen.WaitForString "#"

crt.Screen.Send "dir " & vbCr

crt.Screen.WaitForString "#"

crt.Screen.Synchronous = False

crt.Session.Disconnect

Wend

fil.Close

End Sub

Last edited by nxg; 10-10-2008 at 10:52 AM.
Reply With Quote