VanDyke Software Forums

VanDyke Software Forums (https://forums.vandyke.com/index.php)
-   Scripting (https://forums.vandyke.com/forumdisplay.php?f=14)
-   -   Differentiating SSH Failure and Authentication Failure (https://forums.vandyke.com/showthread.php?t=10824)

Lukesh 01-10-2013 10:42 PM

Differentiating SSH Failure and Authentication Failure
 
Please suggest me how to differentiate the SSH failure and authendication failure on the below script.

ConnectionString = "/SSH2 /L " & strUsername & " /PASSWORD " & strPassword & " /AcceptHostKeys "& strCurrentHostname

crt.Session.Connect ConnectionString

On Error Resume Next.

rtb 01-11-2013 10:01 AM

Hi Lukesh,

Thanks for the question. You can use the following code to determine what error is being returned:
Code:

    On Error Resume Next
        crt.Session.Connect strConnectInfo
        ' Capture the error code and description (if any)
        nError = Err.Number
        strErr = Err.Description
    ' Restore normal error handling so that any other errors in our
    ' script are not masked/ignored
    On Error Goto 0

Is this helpful?

What problem are you trying to solve?

rtb 01-11-2013 01:08 PM

Hi Lukesh,

I was wrong. It is not possible to successfully determine authentication failure using On Error Resume Next with the Connect method, but it should work for connection failures.

It would be necessary to handle the authentication in the terminal window to capture what might be happening. You can find an example of how to do this in the following post:
http://forums.vandyke.com/showthread...7087#post37087
Does this help you accomplish your goal?


All times are GMT -6. The time now is 09:52 AM.