Shortcut to start VPN connection with a single click in Windows 10

Alas, Windows 10 introduced an absurdly complicated way to start a VPN connection where it used to take only a couple clicks. Turns out you can make a shortcut that will allow you to single-click your way into a VPN connection like the good old days.

Winaero.com does a great job of describing how to set up the shortcut link for a VPN connection, but note that this approach will pop up a CMD console which awkwardly sits there the whole time it is connecting. Fortunately, you can turn that off by setting the Shortcut Property for "Run" as "Minimized" instead of the default "Normal Window."

That site doesn't address using a username/password either. If you need these, you can put them in the command, as shown below.

(Note also, you can also create a similar 2nd shortcut for disconnecting with a single click.)

Here are the two shortcuts, and you may want to look closely at the example in the screenshot below.

Connect Insecurely (this works but don't do it, see comments for why):
 C:\Windows\System32\rasdial.exe "MYVPN" username password

Connect Securely (this uses the encrypted username/password stored in VPN config):
 C:\Windows\System32\rasphone.exe -d "MYVPN"
Disconnect:
 C:\Windows\System32\rasdial.exe "MYVPN" /DISCONNECT

How to configure Single Click VPN Connection

Posted in Developing Software on May 22, 2018