SmartCode Solutions Web Forum




Automatic VPN Connections Using RASDIAL

Author Message
 Posted Wednesday, February 01, 2006
Junior Member

Junior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior Member

Group: Forum Members
Last Login: Tuesday, July 11, 2006
Posts: 18, Visits: 155

I thought I would as this tid bit since the section is of the forum looks too empty.

A simple way to auto connect your VPN's to your Registered Servers with rasdial.exe 

1: Configure your VPN connection if you have not done so already.

2: Create an new batch script and name it something descriptive.

3: Edit your new batch script and use the following syntax....

    rasdial.exe "MYVPNNAME" "USERNAME" "PASSWORD"  (no quotes!!!)

4: Save and Exit

5: Create another batch script and name it vpn_disconnect.bat, use this....

    rasdial.exe  /disconnect

6: In VNC Manager go to Tools > Options > Action Scripts > Add

7: Add your vpn_connect.bat and your vpn_disconnect.bat and exit options panel.

8: Right click on the Registered Server you wish to autoconnect to Properties > RDP or VNC Options > Scripts

9: Pre-connect Scripts, Select your vpn_connect.bat

10: Post-disconnect Scripts, Select your vpn_disconnect.bat

11: You should be good to go w00t

Notes: To best of my knowledge you can not used Keys with RASDIAL, you can only use Shared Passwords. Also your passwords are in plain, unencrypted veiw to the world. You may want to place the in a Secured Encrypted Folder.... and lock it down!!!! 

Take a look at rasdial.exe /? for more use of the switches. Last but not least.....This is a Quick, Dirty, Simple way to do this, it is what it is.

Aaron

Post #704
Add to Twitter Add to Facebook
 Posted Tuesday, October 24, 2006
Junior Member

Junior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior Member

Group: Forum Members
Last Login: Monday, July 05, 2010
Posts: 11, Visits: 23
Thanks! That is a great tip!

I added something to it because I only want to automatically connect with VPN when I'm not on my office LAN.

So, to do this, I just check for a piece of my office IP. If it finds this string, it knows I'm on the office network already and skips the VPN connection. The text in () is just for notes:

ipconfig | findstr "192.168"  (this can be any part of your office IP that will always be the same)
if not ERRORLEVEL 0 echo goto :bye  (if no IP with 192.168 in it exists, then skip the next line)
rasdial.exe WorkVPN joeuser joepassword

:bye

Post #1202
Add to Twitter Add to Facebook
 Posted Monday, October 30, 2006
Junior Member

Junior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior Member

Group: Forum Members
Last Login: Monday, July 05, 2010
Posts: 11, Visits: 23
Had a type in one line of the batch file script above. It should be this:

if %ERRORLEVEL% == 0 goto :bye

Post #1213
Add to Twitter Add to Facebook


Similar Topics

Expand / Collapse

Reading This Topic

Expand / Collapse