SHARE
TWEET

Untitled

a guest Dec 29th, 2016 204 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @echo off
  2.  
  3. cls
  4. echo.
  5.  
  6. REM put your VPN connection name here
  7. set myvpn="Your VPN name"
  8. REM put your user here
  9. set myuser="foo"
  10. REM put your pass here. Leave * for asking
  11. set mypass="testpass"
  12. REM put your win admin user here
  13. set winadmin="administrator"
  14. REM put your network route here
  15. set network="192.168.8.0"
  16. REM put your network mask here
  17. set mask="255.255.255.0"
  18. REM put your gateway mask here
  19. set gateway="192.168.1.1"
  20.  
  21. ipconfig | find /i %myvpn% > nul 2>&1
  22.  
  23. if %ERRORLEVEL% == 0 (
  24.  
  25.     echo "VPN already connected. Disconnecting..."
  26.     echo.
  27.     rasdial %myvpn% /disconnect
  28.     runas.exe /user:%winadmin% /savedcred "route delete %network% mask %mask% %gateway%"
  29.  
  30. ) else if %ERRORLEVEL% == 1 (
  31.  
  32.     echo "VPN not connected. Connecting..."
  33.     echo.
  34.     rasdial %myvpn% %myuser% %mypass%
  35.     runas.exe /user:%winadmin% /savedcred "route add %network% mask %mask% %gateway%"
  36. )
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top