VPN reconnection option if not connected


i have a very simple batch file to run on startup, is there anyway to run this if it drops or if a cable was unplugged?

Rasdial test test test$2010
Who is Participating?
Steve KnightConnect With a Mentor IT ConsultancyCommented:
You could leave a script running which periodically tries to ping something and if it fails then try a redial:

@echo off
ping -n 2 -w 1000
if errorlevel 1 Rasdial test test test$2010
REM ait 60 secs
ping -n 60 -w 1000 >NUL
goto start
QlemoBatchelor, Developer and EE Topic AdvisorCommented:
That's what I had in mind, too, but it is "brute force", and I didn't like the idea.
Can we rely on that it is Vista, 2008 or Windows 7 we are talking about?
Steve KnightIT ConsultancyCommented:
Thanks.  Like Qlemo said perhaps not the most elegant plan but it depends upon the cirumstances and what you need it to do.  May be better to sort out whatever timeout issue there is, or have a constant PING going every 60 seconds or similar to keep the connection active etc.   Another couple of answers in "Windows Batch Scripting" and thats a "Sage" for me so thanks for the points :-)

QlemoBatchelor, Developer and EE Topic AdvisorCommented:
I have been working on an elegant solution using Task Scheduler and Event Triggers. That works starting with Vista.
An event-triggered script can be defined in Task Scheduler, and that  is only called when the event is triggered, of course, that is on disconnect. Still interested?
Steve KnightIT ConsultancyCommented:
Well I'm interested :-)
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.