Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I use a VPN to connect to the office from home. I use Windows XP's built-in VPN support for this.

Due to some unfortunate subnet choices, I must run a script to set up some network routes every time the VPN connection has been established. At present, this is a batch file that invokes a PHP CLI script.

The VPN connection is limited to 12 hour sessions; Windows will automatically re-establish the connection, but how can I tell it to invoke my routes script once it's done so?

(If I don't, some buggy software I use leaks file descriptors like nobody's business as it keeps trying to re-establish the connection, and sometimes this causes problems for me: if the machine is unattended, networking becomes unusable after a few hours and I have to reboot, rather than my preference of hibernating all the time.)

share|improve this question
    
Why not setup a scheduled task to run every few minutes just grab the output of route. If your static routes don't exist, but the VPN link is up, then add the routes. BTW have you tried passing the -p option to route to setup a persistent route? –  Zoredache Sep 21 '11 at 22:18
    
@Zoredache: The gateway changes each time I connect to the VPN so I don't think that persistent routes will help. A scheduled task might do it but then there's potentially a small delay between VPN connectivity and establishing routes, which would be irritating were I working at the time. –  Lightness Races in Orbit Sep 22 '11 at 9:25

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.