OpenVPN Auto Connect At Login

Time and time again I have clients requesting that OpenVPN GUI connect automatically when they login to their windows machine. Although there is no built in solution using OpenVPN GUI, it can be done. Below we will detail the three step process that will be required to enable OpenVPN Auto Connect. The first step is to ensure you have a working connection using OpenVPN GUI. If your connection requires a username and password, please see that section below, if not, continue reading. In step two you will need to edit/add a registry key at the path highlighted in red pictured below.ovpn-auto-connect

So here are the meat and potatoes. In order to bring it all together, you will need to either edit or create the registry key highlighted above in yellow. Of course on your installation you will need to replace Corporate.ovpn with the name of your configuration file. If all went well, the next time you login to Windows, OpenVPN GUI will attempt to log in to the OpenVPN server that the config file is pointing to.

Note: If you built a custom client based on my previous article Custom OpenVPN Installer (NSIS), then the openvpn-gui registry key will likely already exist. If not, simply right click the open area and create a new registry entry of the type string value using any name you would like.

Windows Vista, 7 and 8 Run As

OpenVPN-GUI must be run as administrator in order for the OpenVPN GUI to properly function. To run as administrator simply right click on openvpn-gui.exe, select Properties > Compatibility. Check the Run as Administrator box.

Username and Password Required

First, create a file in your OpenVPN/config folder named auth.txt. Once created, on the first line type your user name and on the second line type your password and then save the file. Next, edit the .ovpn file referenced above in your launch string and find the line that reads auth-user-pass and change it to auth-user-pass auth.txt then save and exit.

Did you find this article useful? Why not share it with your friends?

One thought on “OpenVPN Auto Connect At Login

  1. Thank you for publishing this awesome article.
    I’m reading your blog since a long time already but I never compelled to leave a
    comment. I registered your blog in my rss feed
    and shared it on my Twitter. I will come back for sure
    to check your future posts!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.