View Single Post
Old 03-15-2012, 12:43 PM
miked's Avatar
miked miked is offline
Registered User
Join Date: Feb 2004
Posts: 2,040
The script should verify that logon was successful. The following block of your code has a comment that says "check if it is OK" but nothing in the code actually checked to see if logon or anything else was okay. Error checking will help.
'get required info and check if it is OK
crt.Screen.WaitForString ("sername:")
crt.Screen.Send "user" & vbCr
index = Crt.Screen.WaitForString("CODE:")
index = crt.Screen.WaitForString("#")
timeout = 3
index = crt.Screen.WaitForString("<<<", timeout)
index = crt.Screen.WaitForString("#", timeout)
There's a timeout of 3 in the code block above. The timeout lets the script proceed past the line regardless of whether or not the string is found. There's no attempt in the code to determine whether either string was detected. Nothing assures at this point that logon succeeded. The script continues, and writes some things, and that's what you're reporting as a problem, but I believe that's long after the real problem. The wheels fell off the vehicle long before the trail of unwanted garbage being left behind in the problem log file. I think the problem is that the script isn't handling the situation of logon failure.

You'll need to go back and look at a SecureCRT log file, probably raw log (raw log captures all data including escape characters), and see what you notice being sent from the server in the failure cases. Hopefully you see something like "logon failed" or "password incorrect", so that you can write logon failure situation handling into the script.

Some slightly more specific comments that might help get things back on track.

There are two WaitForString statements, back to back. That looks like a possible mistake. Do you really want to wait for "<<<" or "#", or do you actually want to wait for <<< and then # to appear sequentially?

Are there any other strings that you would watch for to tell you that authentication failed or succeeded (this is when/why the SecureCRT log file is important).

If you would like assistance figuring out the correct strings to wait for, please send a raw log to with subject Mike Forum Thread 10351. Please do not post a raw log to the forums as it may contain sensitive data.

To create a raw log:
  1. Before connecting with the session, select "Raw Log Session" from SecureCRT's "File" menu.
  2. In the "Select Log File" dialog, choose a folder and filename in which you would like the log text to be stored and press the "Save" button. At this point, if you open the "File" menu, you will notice that the "Raw Log Session" menu item now has a check-mark next to it; this indicates that raw logging is activated.
  3. Now connect to the remote machine and perform the actions which cause the reported problem to occur.
  4. Once the problem occurs, disconnect the session and select "Raw Log Session" from the "File" menu to turn off the raw logging feature.
  5. Browse to the location of the raw log file and add the file as an attachment to your e-mail reply.
VanDyke Software
Technical Support
Reply With Quote