How to make the VPN client connect automatically at logon Print

  • VPN installazione client, vpn autologin, vpn windows
  • 0

Many people want their OpenVPN connection to automatically start and log in when they start their computer, although there is no direct option in OpenVPN for Windows to do this, it can be done.

The first step is to start OpenVPN as per attached configuration so that it can connect to the cloud network.

The following startup string is required for both methods:

For 32-bit Windows - "C: \ Program Files \ OpenVPN \ bin \ openvpn-gui.exe" - connect xxxxx.ovpn

For 64-bit Windows - "C: \ Program Files (x86) \ OpenVPN \ bin \ openvpn-gui.exe" - connect xxxxx.ovpn

The xxxxx is replaced with the name of the OpenVPN configuration file you want to start. Your list of available .ovpn files is located in the "OpenVPN / config" folder on your computer.

Now you need to add it to the Windows registry startup settings. Open regedit on your computer and go to:

HKEY_CURRENT_USER \ Software \ Microsoft \ Windows \ CurrentVersion \ Run

Add a new string entry. Give it a name that you can later identify as "openvpn" then add the string above.


Note 1 : If Windows is not on the C: drive or you have OpenVPN installed in a different location, you will need to change the position in the string above to match your configuration. You can also use relative location as% ProgramFiles% instead of C: \ Program Files. However, this only solves the Windows problem on a different drive. If OpenVPN was loaded in a non-standard location, you will still need to change the string.

Note 2 : For Windows Vista and Windows 7 and 8, OpenVPN-GUI must be run as an administrator for the VPN to work properly. The most direct way to avoid these conflicts is to disable UAC in Windows 7 and Vista. You can also set the program to always run as an administrator in the application properties. Right click on "openvpn-gui-1.0.3.exe", select "Properties", then "Compatibility". Check the "Run as administrator" box.

When Windows starts, it will launch OpenVPN and attempt to access the VPN server that the configuration file points to.

OpenVPN will likely ask for a username and password - this is where things get problematic in Windows. Currently, there is no secure way to store username and password in Windows using OpenVPN. For security reasons, most versions of OpenVPN do not allow reading a user / password from a file. If one is willing to take the security risk of having their login information saved in clear text on their hard drive, they can have OpenVPN log in automatically.

Recognizing the security risks, the procedure is as follows:

NOTE : Recent versions of OpenVPN for Windows have ability to save users and passwords in the application and these steps are no longer required.


1 - Create a file in the OpenVPN / config folder named password.txt

In the first line type your username, in the second line type your password

Save the file.

2 - Edit the above .ovpn file in the boot string and find the line that reads "auth-user-pass".

Change it to "auth-user-pass password.txt". Save and exit.

3 - Install OpenVPN version 2.3 which supports this feature


Was this answer helpful?

« Back