Sunday, May 20, 2012

Windows VPN Connection with automatic routes added without default gateway option

type c:\windows\vpn.bat

@echo off
rasdial VPN_CONNECTION_NAME USERNAME PASSWORD
for /f "tokens=15 delims= " %%A in ('ipconfig ^| find "192.168.200"') do @set GW=%%A
route add 192.168.45.0 mask 255.255.255.0 %GW%

No comments: