Welcome to the VanDyke Software Forums

Join the discussion today!

Go Back   VanDyke Software Forums > Scripting


Thread Tools Rate Thread Display Modes
Old 08-17-2013, 01:57 PM
anunda anunda is offline
Registered User
Join Date: Jan 2013
Posts: 1
Add timeout on script

I have been using the scripting function to automatic different functions with Cisco devices usually 200-500 devices. All the routers authenticate through a tacacs server. The problem I have is that I will run into a router that will not authenticate or has been taken off line and the whole script will freeze up. How can I put a timeout value so it will skip a router/host that does not respond?

example of script:

' Verbiles to use in scripts
Dim Username
Username="NAME "
Dim Password
DIm Enablepassword
DIm Command
Command="term len 0"
DIm Command2
Command2="sh run "
Dim host(200)
host (0) = ""
host (1) = ""
host (2) = ""
host (3) = ""
host (4) = ""
host (5) = ""

For Each strHost In host
If strHost = "" Then Exit For
' Make sure we are disconnected before attempting a connection
If crt.Session.Connected Then crt.Session.Disconnect

' connect to host on port 23 (the default telnet port)
crt.Screen.Synchronous = True
crt.Session.Connect "/TELNET " & strHost

''''''''''''''' Login Part ''''''''''''''''''''''

crt.Screen.WaitForString "sername:"

crt.Screen.Send Username & vbCr

crt.Screen.WaitForString "assword:"

crt.Screen.Send Password & vbCr

crt.Screen.WaitForString ">"

crt.Screen.Send "en" & vbCr

crt.Screen.WaitForString "assword:"

crt.Screen.Send Enablepassword & vbCr

' worked to log last host. how to append

crt.session.LogFileName = "c:\temp\"&strHost&".txt"


crt.Screen.WaitForString "#"

crt.Screen.Send Command & vbCr

crt.Screen.WaitForString "#"

crt.Screen.Send Command2 & vbCr

crt.Screen.WaitForString "#"

Reply With Quote
Old 08-19-2013, 08:55 AM
rtb rtb is offline
VanDyke Technical Support
Join Date: Aug 2008
Posts: 4,305
Hi anunda,

Thanks for the question. One way to accomplish your goal would be to handle the connection and authentication in a tab. You can find an example of how this can be done at the following location:
Does this help you accomplish your goal?

VanDyke Software
Technical Support
Reply With Quote

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 03:14 PM.