VanDyke Software Forums

VanDyke Software Forums (https://forums.vandyke.com/index.php)
-   Scripting (https://forums.vandyke.com/forumdisplay.php?f=14)
-   -   Switch Audit Script waits unexpectedly (https://forums.vandyke.com/showthread.php?t=10665)

olivebranch2006 09-10-2012 06:47 PM

Switch Audit Script waits unexpectedly
 
1 Attachment(s)
Hello,

I wrote an audit vbscript which SSHs into a cisco switch, runs commands, records the results into Excel spreadsheet, exits that switch and repeats for every switch listed in column B of the spreadsheet.

Sometimes it works perfectly and sometimes it does this:

stops at script line 2940
crt.Screen.WaitForString("sh cdp ne ")

the strange thing is that this line 2940 reads the response from the command issued on line 2938:

crt.Screen.Send "sh cdp ne gi" & objSheet.Cells(rownum, lwap1portcol).Value & " de" & vbCr

and the script manages to go through line 2938 but the command "sh cdp ne gi yada yada" never is sent to the switch console?

Bizarre.

Any help you could offer would be greatly appreciated! Full script and spreadsheet attached.

Thanks,


Christo

rtb 09-11-2012 09:16 AM

Hi Christo,

Without knowing anything about the devices to which your script is connecting, my guess is that the issue is in the order of the lines of code below:
Code:

    crt.screen.waitforstring hostname
    crt.Screen.WaitForString("sh cdp ne ")
    crt.Screen.WaitForString(vbCr)
    crt.Screen.WaitForStrings "Device ID: ", "#"

You are waiting for a hostname prior to waiting for the command. Do you expect to receive the hostname from the remote device prior to the command being echoed?

olivebranch2006 09-12-2012 05:26 PM

Hostname it is!
 
That was it! After removing the hostname, it worked. That was a mistake, don't know why I put that there.

Thanks!


All times are GMT -6. The time now is 12:44 PM.