View Single Post
  #1  
Old 06-12-2019, 03:30 AM
Freddie Freddie is offline
Registered User
 
Join Date: Jun 2019
Posts: 2
How to move the script to the next step

Good Day,,
Can you assist me with the issue that I am having with my script.

I have a script to log into devices and change passwords for two different accounts. At times, there may be a device ( I use an IP list), that may be offline/no longer on the network, etc. When that happens, the script stops. I then have to go back to the list remove that device then start over. Is there a way for me to tell the script to move to the next line item (instead of cancelling), then send me an email with the failed IPs?

Questions2:
What do I use to add a comment is it this (')?

Here is my script.
Const username = "xxxxx" ' Username to use for login
Const password = "xxxx" ' Password for corresponding user

Const DEVICE_FILE_PATH = "xxxxxx.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

'MsgBox "IP address is: " & ip

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

' Connect

crt.Screen.Synchronous = True
crt.Session.Connect cnxnString
crt.Screen.WaitForString ">"

crt.Screen.Send "lock database override" & chr(13)
crt.Screen.WaitForString "> "
crt.Screen.Send "set user admin password" & chr(13)
crt.Screen.WaitForString "New password:"
crt.Screen.Send "XXXXXX" & chr(13)
crt.Screen.WaitForString "Verify new password:"
crt.Screen.Send "XXXXXX" & chr(13)
crt.Screen.WaitForString "> "
crt.Screen.Send "st " & chr(8) & chr(8) & "et expertp" & chr(8) & "-asswo" & chr(8) & chr(8) & chr(8) & chr(8) & chr(8) & "password" & chr(13)
crt.Screen.WaitForString "Enter current expert password:"
crt.Screen.Send "XXXXXX" & chr(13)
crt.Screen.WaitForString "Enter new expert password: "
crt.Screen.Send "XXXXXX" & chr(13)
crt.Screen.WaitForString "Enter new expert password (again): "
crt.Screen.Send "XXXXXX" & chr(13)
crt.Screen.WaitForString "> "
crt.Screen.Send "expert" & chr(13)
crt.Screen.WaitForString "Enter expert password:"
crt.Screen.Send "XXXXXX" & chr(13)
crt.Screen.WaitForString "# "
crt.Screen.Send "exit" & chr(13)
crt.Screen.WaitForString ">"
crt.Screen.Send "save config" & chr(13)
crt.Screen.Send "exit" & chr(13)
crt.Screen.Synchronous = False
crt.Session.Disconnect

Wend

fil.Close

End Sub
Reply With Quote