VPN Auto Connect

I am incredibly proud of VPN Auto Connect, my most recent automation script and I strongly encourage anyone that is concerned about maintaining a VPN connection try out this tool.

In today’s world, keeping your data anonymous and encrypted on the internet is necessary to protect yourself. To that end, VPNs have become increasingly popular. But VPNs can and will occasionally get disconnected, leaving you exposed. Some VPNs offer a “kill switch” baked into their software to disable your entire internet connection when you get disconnected, but very few are able to disable just a certain program (e.g. uTorrent) or re-connect to the same or alternate VPN servers… enter VPN Auto Connect.

This windows script will ensure you are always connected to your VPN (using OpenVPN GUI). If disconnected, it will try to reconnect to one or more pre-set ovpn configuration files. If a connection cannot be established, this script can (optionally) kill uTorrent and (optionally) send you email notifications. After a failed connection attempt, you will only be notified when a connection is re-established (i.e. you won’t get an email every X minutes if connection attempts keep failing). When a connection is re-established, you can (optionally) auto-restart uTorrent.

All options can be customized in the using the “Configurator for VPNAutoConnect” tool; alternatively you can edit the settings file directly using a text editor. Here you can also adjust the verbose setting to have VPNAutoConnect.exe launch invisibly, ideal for background usage and scheduled tasks. You can also specify an alternate opvn config directory, in case you want to auto-connect to different VPN config file(s) than those used in OpenVPN GUI. All action taken by this script will be logged in the same directory as the script itself.

The script will loop through each ovpn config file located in the config directory in alphabetical order until the number of set connection attempts is reached or a connection is successfully established. You must ensure that the opvn config files are set up in such a way that they are able to connect without requiring additional information (i.e. username and passwords must be built in). Saving your password in OpenVPN for automatic login is explained at http://www.tiny.cc/ovpnlogin. Alternatively, you can contact your VPN provider for support if this method doesn’t work (my VPN provider was able to supply an unencrypted key file).

Use the Configurator to schedule a task to run VPNAutoConnect every X minutes (or do it the old fashioned way using windows task scheduler directly) to check if disconnected and try to re-establish a VPN connection. Do not worry about having more than one instance of the program running at one time, as the exe will not execute if another instance is already running. In other words, if you schedule this to run every minute it won’t run until the previous instance has finished.

To ensure you’re fully protected, you should also follow additional VPN precautions and VPN leak tests at http://www.tiny.cc/vpnleak. This will explain how to disable IPv6 on your VPN adapter, set up an alternate DNS provider so your ISP won’t be able to detect DNS leaks, and more.
If using VPNSecure app instead of OpenVPN
Adjust the settings accordingly, and this script is able to connect to the top most “Recent” server in VPNSecure’s app (v2.0.7). To work, you must manually connect to a server at least once to make sure there is a server listed under “Recent”.

v1.0 released July 17, 2016
v1.1 released July 22, 2016
-added admin rights prompt to exe
-added warning if not being run with admin rights
-added ability to reset TAP adapter to auto-troubleshoot general WiFi dis-connectivity
v1.2 released July 31, 2016
-added “Configurator for VPNAutoConnect” tool to enable easy configuration and task scheduling of VPNAutoConnect

Download VPN Auto Connect


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 )

Google+ photo

You are commenting using your Google+ 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 )

Connecting to %s