Multiple methods of connecting to device
I am trying to use SecureCRT to connect to a device first trying ssh and if it fails, then use telnet. The script runs fine if the device supports ssh, but if it does not and only supports ssh, I am getting a Runtime error. Here is my code -
# $language = "VBScript"
# $interface = "1.0"
crt.Screen.Synchronous = TRUE
prompt = "Password: "
device = crt.Arguments(0)
user_name = crt.Dialog.Prompt("Enter your TACACS userID ", user_name, "TACACS Login",False)
passwd = crt.Dialog.Prompt("Enter your TACACS Password ", passwd, "TACACS Password",True)
cmd = "/SSH2 /L " & user_name & " /PASSWORD " & passwd & " " & device
if crt.Screen.WaitForString(device, 4) = True then
crt.window.caption = device
' crt.Screen.Send passwd & vbCr
crt.Screen.Send "telnet " & device & chr(13)
crt.Screen.Send user_name & vbCr
crt.Screen.Send passwd & vbCr
|Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)|
|Display Modes||Rate This Thread|