I'm looking to pull a text document or single field CSV document into an array then loop through the array.
I've been through a few examples on here but continue to fail to get the script working.
Any insight would be appreciated and sorry if I missed a previous useful posting.
]
I've been through a few examples on here but continue to fail to get the script working.
Any insight would be appreciated and sorry if I missed a previous useful posting.
Code:
#$language = "VBScript"
#$interface = "1.0"
crt.Screen.Synchronous = True
Sub Main
Set fso = CreateObject("Scripting.FileSystemObject")
Set hosts = fso.OpenTextFile("C:\Users\XXXX\Documents\2016\3 SmartServices\SNMPHosts.txt")
Do Until hosts.AtEndOfStream
strNextLine = hosts.Readline
arrServiceList = Split(strNextLine , ",")
Loop
hosts.Close
For Each item In hosts
crt.Screen.Send "telnet " & item & chr(13)
crt.Screen.WaitForString "username: "
crt.Screen.Send "UUUU" & chr(13)
crt.Screen.WaitForString "password: "
crt.Screen.Send "PPPP" & chr(13)
crt.Screen.WaitForString ">"
crt.Screen.Send "en" & chr(13)
crt.Screen.Send "PPPP" & chr(13)
crt.Screen.WaitForString "#"
crt.Screen.Send "conf t" & chr(13)
crt.Screen.WaitForString "(config)#"
crt.Screen.Send "COMMAND STATIC TEXT" & chr(13)
crt.Screen.Send "COMMAND STATIC TEXT" & chr(13)
crt.Screen.WaitForString "(config)#"
crt.Screen.Send "end" & chr(13)
crt.Screen.WaitForString "#"
crt.Screen.Send "wr" & chr(13)
crt.Screen.WaitForString "#"
crt.Screen.Send "exit" & chr(13)
crt.Screen.WaitForString "WAIT END STRING"
Next
End Sub