How ToWindows

How to automatically reconnect Windows 10 VPN

If you’re attempting to get some semblance of stability using Windows built-in VPN networking and finding that there really is none, here’s a quick little setup that can at least keep you connected to wherever your VPN tunnel leads.

This assumes you’re using Windows 10 built-in VPN and probably something equally lacking in features on the other side, such as if you’ve had to rig up a software VPN with no budget and minimal time, or you just hate working software. This probably will work with older versions of Windows, but here are two parts of it that work in Windows 10 and screenshots.

This also assumes security is not something you’re really considering as you’re going to be putting a password in plain text in a task. I’ll assume you work for whatever major company got caught not storing their passwords hashed this week, that or you’re just rigging something for an offsite backup.

The first is the command line to connect your VPN. You’ll need to know what you named it, you’ll need to know your user name, and you’ll need to know your password.

So check that one of the following commands actually will connect you by opening a command prompt and typing them out.

c:\Windows\System32\rasdial.exe connection_name user_name password

If you’re logging in with a domain name it’s more in the format

c:\Windows\System32\rasdial.exe connection_name user_name password /DOMAIN:domainname

If neither of those work, stop, nothing to be gained by going forward

Create a reconnect task

Your VPN gets disconnected a lot, you can schedule a reconnect every X minutes. Alternately you can create a triggered task that looks for a disconnect. Your RasClient disconnect task event ID is 20226 from Application log, source RasClient.

Below are the three task manager screens you’ll be working on to create your VPN reconnect task.

Task Scheduler general

Task Scheduler action

Trigger warning

Security warning

You just saved your VPN password in plain text in a task scheduler. While probably not a big deal if you’re dealing with having to use the built-in networking components with your work, might be aware that you’re really throwing security right out the window if anyone managed to get access to your computer.

If you’re worried about saving the password and just want a prompt to reconnect you could just create a triggered task to open Notepad with a text document telling you you’ve been disconnected again.

Groundhog day warning

You’ve created a task that automatically reconnects you if you’ve been disconnected. This does not stop when you click disconnect, nope, 30 seconds or whatever you put in later you’re reconnected. While it’s easy enough to kill or pause the task, it’ll be just about as inconvenient as standard Windows 10 VPN is in the first place.

Seriously, why is there no option to redial in 2018?

Alternate useful command

If you’re just connecting and disconnecting for remote syncing or something after connecting and doing your business another useful command is rasdial [entryname] /DISCONNECT. You can omit the entryname if you’re only dealing with one VPN.

Pocketables does not accept targeted advertising, phony guest posts, paid reviews, etc. Help us keep this way with support on Patreon!
Become a patron at Patreon!

Paul E King

Paul King started with GoodAndEVO in 2011, which merged with Pocketables, and as of 2018 he's evidently the owner. He lives in Nashville, works at a film production company, is married with two kids. Facebook | Twitter | Donate | More posts by Paul | Subscribe to Paul's posts

Avatar of Paul E King