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
- 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