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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Steve KnightIT 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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Qlemo"Batchelor", 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 :-)

Qlemo"Batchelor", 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 :-)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.