Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > Scripting

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 11-27-2008, 02:59 AM
seteshpl seteshpl is offline
Registered User
 
Join Date: Nov 2008
Posts: 10
Connection via serial

Hello,

I would like to write a script, that will automatically erase cisco router configuration and reset it. My script looks as follows:
Code:
# $language = "VBScript"
# $interface = "1.0"

Sub Main
Dim cmd
cmd = "/SERIAL COM4"
crt.Session.Connect cmd
crt.Screen.Send( vbCR )
crt.Screen.WaitForString( ">" )
crt.Screen.Synchronous = True
crt.Screen.Send( "en" & vbCR )
crt.Screen.WaitForString( "#" )
crt.Screen.Send("write erase" & vbCR)
crt.Screen.WaitForString( "[confirm]" )
crt.Screen.Send( vbCR )
crt.Screen.WaitForString( "#" )
crt.Screen.Send("reload" & vbCR)
crt.Screen.WaitForString( "[confirm]" )
crt.Screen.Send( vbCR )
crt.quit

End Sub
unfortunately it does not work. When I change it from SERIAL to TELNET it seems that everything is okay. Any ideas how to make it work via serial (console cable). Thanks!
Reply With Quote
  #2  
Old 11-28-2008, 08:20 AM
kbarnette kbarnette is offline
VanDyke Technical Support
 
Join Date: Aug 2007
Posts: 587
HI seteshpl,

Thanks for providing your script as it exists thus far.

Could you explain more about what you mean by 'it does not work' when connecting with serial?
Where does the script fail?

What errors are generated?
Also, are you able to run through this same process manually when connecting with serial?
Reply With Quote
  #3  
Old 12-01-2008, 11:04 AM
seteshpl seteshpl is offline
Registered User
 
Join Date: Nov 2008
Posts: 10
Okay, problem solved. I tried to connect with Cisco router.
The correct cmd should be:

Code:
/serial com4 /baud 9600 /cts /data 8 /parity none /stop 1
Thanks!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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 06:19 PM.