Welcome to the VanDyke Software Forums

Join the discussion today!

Go Back   VanDyke Software Forums > Scripting


Thread Tools Rate Thread Display Modes
Old 05-07-2019, 02:03 PM
tunes4life tunes4life is offline
Registered User
Join Date: May 2019
Posts: 1
Login To Various Devices

I'm trying to create a script that will login to various cisco devices. They all have the same username / password but the login method can be SSH or Telnet. I have pasted the current script I have been using. This has worked for the most part. The biggest problem is, after I have logged into a device, and the device times out, I get a script error popup for every one. It says:

ScriptError - Error: Connection Lost
File: C:blahblahblah/python.py Line 14
crt.Screen.WaitForString("sername:" or "login:")

I'm mostly looking for a way to do some error checking in the script to eliminate this constant error. I would love to be able to try SSH and fail back to Telnet if SSH is not available if possible too. Any suggestions would be appreciated.

The current script:

# $language = "Python"
# $interface = "1.0"

# Login to Cisco Devices

def main():

crt.Screen.Synchronous = True
#The above waits for a command prompt


crt.Screen.WaitForString("sername:" or "login:")


crt.Screen.Synchronous = False

Reply With Quote
Old 05-07-2019, 03:25 PM
bgagnon bgagnon is offline
VanDyke Technical Support
Join Date: Oct 2008
Posts: 4,636
Hi tunes4life,

What version of SecureCRT are you running? On what platform?

How do you run the script?

Please list the explicit steps involved.

This has worked for the most part.
Elaborate on worked for the most part because this does not really seem like proper syntax to me. :)

In particular, I'm thinking you want to use WaitForStrings() (plural) instead of this line:

crt.Screen.WaitForString("sername:" or "login:")

I think with the syntax you have used the script would only be waiting for that first literal (sername:).

Is this a complete script? (Other than masking credentials, which is fine.) Or have you just posted part of it?

VanDyke Software
Technical Support
(505) 332-5730
Reply With Quote

cisco , error , login , python , script

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT -6. The time now is 07:02 PM.