Python Script to dial a VPN connection, automate VPN routing table updates.

Warren Postma warren-postma at
Fri Mar 23 20:38:13 CET 2001

Sorry for the nearly-off-topic nature of this post, but ....

I work from home now, and there's something in Windows 2000 that's
annoyingly manual:

I have a permanent internet connection via @home cable modem, and I "dial"
through that to create a VPN connection to the office.  The problems are

(1) Windows won't accept or save my userid, password and the domain name, so
I have to enter it manually.

(2) After connecting, I have two default gateways in my routing tables
(ROUTE PRINT) and I need to update it so only the traffic that is destined
to the office goes through that interface.  The IP addresses I get given are
different each time, making a batch file insufficient, so voila, a perfect
use for python.

So after solving #2 above in Python, I wondered, does anyone know how, in
Python win32 extensions, one might dial an RAS connection, and if it's
possible to do so  through the win32 API somewhere or through COM? Then I
could solve #1 above as well.

Anyone else think this might make a nice little Python applet if I build in
some more VPN/RAS stuff and maybe even Gui-fy it a bit in wxPython or

Warren Postma

More information about the Python-list mailing list