In the past I wrote a couple of articles explaining how to connect to a business network using a Windows VPN prior to logon, so that domain authentication takes place and group policies and logon scripts are applied.  See:  Win 7 and earlier and Win 8

As pointed out in the articles, this only works for domain joined computers.  It has been brought to my attention that some folks would like to automate the VPN connection process on non domain joined machines.   .

Automate VPN connection – AFTER logon:

Basically you need a one line batch file and add it to the startup folder, but in detail:

  • Open a text editor such as Notepad and enter the lines below, substituting the name of your VPN connection for Acme, and inserting your user name and password

rem   Batch file to establish a VPN connection
rasdial  acme  username  password
exit

    • Substituting  *  (an asterisk)  for the password, will prompt for the password during the connection.  This is more secure as the password is stored in clear text in the batch file.
    • Save the file to a location such as the desktop, but when doing so save using a .bat extension and enclose the name in quotes such as;  “VPN_Connect.bat”.  Notepad will add a txt extension if you do not use the quotes.
    • Saving to the desktop allows the user to double click on the file to establish the VPN connection.
    • If you want to automate the connection add the batch file to the startup folder and it will run after logon to the PC has completed.  The startup folder can be found in the following locations:

XP: Documents and Settings\All Users\Start Menu\ Programs\Startup
Win7:  C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp

Comments on: "RASdial (automate VPN connections)" (3)

  1. Hello I connected a Window 10 Home Edition Desktop my VPN which the vpn work great but I also created a batch file to auto connect to the VPN it will connect just fine the first time when you click on the batch file and it work wonderful. until you are ready to shut down the computer but if you disconnected the VPN and try to use the VPN.bat to connected back to it I keep getting the error message ” Remote Access Error 703- The connection needs information from you, but the application does not allow user interaction”
    but it worked fine 5 second before I ran the VPN.bat file. I have it on a laptop computer and it works fine no problems at all and I did the exactly same thing that I did on my laptop but my laptop does have window 10 Professional Edition on it

    the batch I am typing in is
    rasdial username password

    and it works fine on all my other client heck it works fine on the desktop client until you disconnected
    so if anyone could please help me I would really appreciate it

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Tag Cloud