View Single Post
  #4  
Old 05-31-2017, 11:06 AM
ekoranyi ekoranyi is offline
VanDyke Technical Support
 
Join Date: Jan 2017
Posts: 654
Hi respite,

I found a few timing issues but with a little modification it looks like you may have a solution. With the modification I've made does it run as expected?

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

Sub Main()

crt.screen.synchronous = true
on error resume next

Dim vHosts(100)
vHosts(0) = "172.26.25.140"
vHosts(1) = "172.26.37.140"
vHosts(2) = "172.26.24.140"
vHosts(3) = "172.26.94.140"
vHosts(4) = "172.26.203.140"
vHosts(5) = "172.26.100.140"
vHosts(6) = "172.26.103.140"
vHosts(7) = "172.26.56.140"
vHosts(8) = "172.26.132.140"
vHosts(9) = "172.26.60.140"
vHosts(10) = ""

For Each strHost In vHosts

If strHost = "" Then 
	Exit Sub
End If

' Make sure we are disconnected before attempting a connection
If crt.Session.Connected Then crt.Session.Disconnect

' Connect to the next host
crt.Session.Connect "/SSH2 /ACCEPTHOSTKEYS /L ******* /PASSWORD ******* " & strHost 

crt.Screen.WaitForString "admin>"
crt.Screen.Send "sum" & chr(13)

Set g_fso = CreateObject("Scripting.FileSystemObject")
Set objFile = g_fso.OpenTextFile("C:\Users\nmorra\Documents\Scripts\logs\AP_Scan_Type_Log.txt", 8, True)

crt.screen.WaitForString("AP-")
strText = crt.screen.ReadString(vbcrlf)

crt.screen.WaitForString("LAN1 IP: ")
strIP = crt.screen.ReadString(vbcrlf)

objFile.Write strIP & " has model AP-" & strText & vbcrlf
objFile.Close

crt.Screen.WaitForString "admin>"
crt.Screen.Send "quit" & chr(13)
crt.Session.Disconnect

Next 

End Sub
__________________
Thanks,
--Eric

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote