Quickly connect to a VPN on Windows 10

vpn11All-in-all I am very happy with my upgrade from Windows 7 to 10. The procedure was smooth and almost (more on that later) everything still worked like a charm, out-of-the-box, despite having lots of not-so-obvious software on the machine. (Comes with the job as a developer, I guess.)

However, one minor thing very soon annoyed me on Win10 and that was the crappy user experience for connecting to a VPN, despite that shiny new VPN button in the new Action center (btw, action center tip: use WinKey+A), which in itself looked like good idea. I have quite a list of VPN’s defined, first of all to connect to my own office while on the road, and many others to connect to my client’s networks to diagnose problems or perform software updates. So allow me to first complain a bit about what I think is wrong with it, before presenting a workaround (or solution if you will) below.

Compare the following experience on Windows 7 versus that of Windows 10 (or Windows 8).

Windows 7

Easy way to connect

  • Click the network icon in the system tray.vpn1 It will list all your VPN connections:
  • Double-click the VPN connection you want. Done!

Even easier way to connect

Create a desktop shortcut to the VPN by going to the Network Adapter Settings and dragging the VPN icon onto the desktop.


  • Double-click the VPN icon on your desktop. Done!

Windows 10

Easy way to connect?

At first, it appears as if you can still do the same as you were used to.

  • Click the network icon in the system tray. vpn4 It will list all your VPN connections.
  • Double-click the VPN connection you want. Done. No, this will open a new window, which lists all your VPN connections, again. (Huh?)
  • Find the same VPN you double-clicked before in this list. Double-click it. Done. No, double-clicking doesn’t work here. Single-click it.
  • The VPN item expands, now showing a Connect button. Click that.
  • The VPN connects. Click the X to close this window.

That is five actions instead of two.

Even easier way to connect?

It gets even worse here.

That desktop shortcut I created while on 7 was migrated to Windows 10 perfectly fine, so I figured let’s keep using that.

  • Double-click the VPN icon on your desktop. Done. No! This also opens this dreaded window where I have to select the same VPN from the list, again, and perform three more unnecessary clicks where a simple double-click should have sufficed.

That is four actions instead of one.

I find it hard to believe there was no usability expert that has noticed this. It is plain silly UI: why list the VPN’s first from the system tray and allow you to click them, only to make you find and click the same one again from a new window? It makes that first list completely senseless.

Personally, it appears to me like a simple oversight that may be fixed in a future update. vpn9For example: the procedure to create a shortcut to a VPN by dragging it from the adapter list to your desktop still works in Windows 10. This shortcut then even features a context menu items that says Connect / Disconnect. That would make you think it would do precisely that: connect to that VPN. But it doesn’t. It just opens the VPN list window. Why?

The workaround

Fortunately, there is a way to script yourself around this. Enter the rasdial command! (Which also exists on Windows 7 BTW.)

  • Create a batch file on a convenient location and edit it.
  • Paste the following lines (note the use of quotes if there are spaces in the VPN name). The first line is optional.
@echo off
rasdial "My VPN connection name here"
  • Save
  • Create a shortcut to this batch file on your desktop.
  • Optionally give it a nice icon. I took the 115th one from %systemroot%\system32\imageres.dll.

Now, if you double-click the icon on the desktop, you get a brief command window instead of a gui, but the message is the same:


And you just connected to your VPN with a only one double-click. Sigh.

Over Shiftkey
I am Maarten, owner of and chief software developer for Shiftkey software development from The Netherlands. I will be writing mainly about things I run into when programming in C# or Delphi.

29 Responses to Quickly connect to a VPN on Windows 10

  1. Pingback: Quickly connect to a VPN on Windows 10 (revisited) | Shiftkey Software Blog

  2. cactuscraig says:

    so now I need 2 icons – one to connect and 1 to disconnect!

  3. Shiftkey says:

    Yes, that’s true. Although I guess one could attempt to script it into one batch file, depending on the response of rasdial (it says ‘already connected to …’ if you run it for an already connected vpn), but that was not worth the effort for me. I often need to connect to a vpn but quite less often need to explicitly disconnect from it while keeping on working. Most of the time I just shut down my laptop, which also effectively disconnects the vpn. But that may be different for your situation.

  4. SirPlus says:

    rasdial “My VPN connection name here” /Disconnect

    Will Disconnect

  5. Petr says:

    Thanks for the Article i have found this one. It will connect and disconnect 😀

    @echo off
    ipconfig|find/i “MYCON” && rasdial “MYCON” /disconnect || rasdial “MYCON”


  6. Veeeery nice tip! But really, the Microsoft interface designer deserves an award.
    I do not understand how they could complicate something so simple. Unbelievable.

  7. Johan says:

    I have configured myVPN and I ran the following in CMD,

    rasdial “myVPN”


    Connecting to myVPN…
    Verifying username and password…
    Connecting to myVPN…
    Connecting to myVPN…
    Verifying username and password…

    Remote Access error 691 – The remote connection was denied because the user name and password combination you provided is not recognized, or the selected authentication protocol is not permitted on the remote access server.

    But when I connect it in the windows interface it connects perfectly fine… what am I doing wrong?

  8. LRB says:

    What worked for me was to have the initial connection name in lowercase and in quotes and to drop the quotes from the other connection names, so:

    ipconfig|find/i “oracle” && rasdial ORACLE /disconnect || rasdial ORACLE

    The ‘find’ required the quote marks, but rasdial doesn’t in my case.

  9. Thanks, works great! Glad I wasn’t the only one who thought this was a bizarre UI update.

  10. Nass says:

    Really nice trick!
    Think to put “pause” at the end of your .bat files in case if you want to see what’s happenning in the background..

  11. Thank you for all this information. Every version of Windows seems to have some function hidden a menu level deeper than it was last version. This was the one annoying me most about 10.

  12. There is actually a way better and cleaner way to do this. Actually you CAN revert the silly misdesign of Windows 10 network connection procedure back to Windows 7/8 style. The old style networks flyout is still built into Windows and you can reveal it and estore the better one-click behavior of the networks flyout.

    The procedure requires changing one single Registry key however to do this you have to grant yourself permissions to do this so the whole procedure is:

    Open regedit (WIN+R and type regedit.exe)
    Navigate to HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Control Panel\Settings\Network
    Take ownership of the “Network” key/folder (right click, Permissions)
    Select “Advanced” in the Permissions window
    In the Advanced window, select “Change” where the owner field is (at the top of the window)
    Type in your username and save your changes.
    Close the advanced window
    Now select “Administrators” in the security tab
    Make sure “Full control” is selected, then apply changes
    Now that’s done, double click “ReplaceVan”
    Change it’s value to 2

    You can experiment with different values of ‘ReplaceVan’. But the value 2 is what we need.

  13. Pingback: Confluence: Ostatní

  14. Wouter says:

    When using rasphone instead of rasdial, you can connect with just one click.

    You can disable the “Username/Password dialog box” by doing the following:
    Step 1: Open this file in notepad.exe but make first a backup:
    Step 2: Find in the textfile [YourVPNName]
    Step 3: Then find PreviewUserPw=1 under [YourVPNName] ==> Change it to PreviewUserPw=0 Step 4: Save the file

    You can now use rasphone -d “YourVPNName” without a password promt and without having your password in a batch file/the executed command, Windows wil use cached credentials. This works in all Windows versions, including 8/8.1/10.

    Make a desktop shortcut to rasphone -d “YourVPNName” and give it a name. Double click the shortcut and VPN connect.

  15. Ed McCafferty says:

    You can bring back the W8.1 fly out instead…..This makes the old way to connect work again in Windows 10

    Step One: Open Regedit ( How did you know this wasn’t coming ha! ) (WIN+R and type regedit.exe)

    Step Two: Navigate to HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Control Panel\Settings\Network

    Step Three:Take ownership of the “Network” key/folder (right click, Permissions)

    Step Four: Select “Advanced” in the Permissions window

    Step Five: In the Advanced window, select “Change” where the owner field is (at the top of the window)

    Step Six: Type in your username and save your changes.

    Step Seven: Close the advanced window

    Step Eight: Now select “Administrators” in the security tab

    Step Nine: Make sure “Full control” is selected, then apply changes

    Step Ten: Now that’s done, double click “ReplaceVan

    Step Eleven: Change it’s value to 2

  16. Windows 7 and up has all you need, not commandline no free Tools needed…

    Go to the system32 directory, run the rasphone.exe. Pin it to your taksbar and there you go…


    You will have a nice little Gui to manage your VPN’s

    Enjoy !

Geef een reactie

Vul je gegevens in of klik op een icoon om in te loggen.

WordPress.com logo

Je reageert onder je WordPress.com account. Log uit /  Bijwerken )

Google photo

Je reageert onder je Google account. Log uit /  Bijwerken )


Je reageert onder je Twitter account. Log uit /  Bijwerken )

Facebook foto

Je reageert onder je Facebook account. Log uit /  Bijwerken )

Verbinden met %s

%d bloggers liken dit: