Quickly connect to a VPN on Windows 10 (revisited)

Update (June ’17): it has taken more than 1,5 years since I posted this, but the Windows 10 “Creators Update” finally contains a Connect button right in the Network Connections flyout… 🙂

Earlier I wrote about a trick to make Windows 10 connect to a VPN with a single action (double-click) instead of three or more. I recently found that this trick had a limitation: it only worked because the username and password for my VPN connection were the same as the username and password of the Windows 10 computer I was using (a local account). On another Windows 10 pc that was using a Microsoft account, it failed telling me the username / password was not correct:

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.

Because it worked on the first pc, I assumed that rasdial used the username/password I stored in the VPN configuration. It looks like it doesn’t, but uses your Windows username/password instead (need to verify this). One could discuss whether that is a bug or a feature, but in the end, the result is that it doesn’t work for me.

So I started looking for alternatives. Other tricks I found involved storing the username/password in the command file, but I did not want to do that. The solution is to not use rasdial, but it’s nephew rasphone.

Change the line

rasdial "My VPN connection name here"


rasphone -d "My VPN connection name here"

Mind the -d before the name of the connection.

It shows the familiar connecting dialog, instead of the command line window, and it just works.

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.

10 Responses to Quickly connect to a VPN on Windows 10 (revisited)

  1. Paulo says:

    Thank you so much. You save my life! 🙂

  2. John says:

    This actually works compared to the earlier RASDIAL solution. Unfortunately this one still pops up a windows with the credentials (remembered) to which I need to click [CONNECT]. There doesn’t seem to be a ‘quiet’ option for connecting?
    Almost there 🙂
    Chat soon.

  3. Ndi says:

    Just give it user/pass in the command line and it will work (if less secure). Just remember to Echo Off unless you want all your passwords displayed.

    Here’s my logon script:
    @echo off
    Echo Cleaning up…
    REM NET USE z: /delete
    REM NET USE y: /delete
    Echo Z:
    NET USE Z: \\\Zeus /persistent:no /user:admin XXXXX
    Echo Y:
    NET USE Y: \\\Swap /persistent:no /user:admin XXXXX
    Echo D:
    NET USE D: \\\D /persistent:no /user:XXXXX YYYYYY
    Echo VPN
    Echo Done. Bye.
    wait 5

    I could write some executable that hides all this under the hood if anyone is interested. I work in a VM so I don’t care.

  4. Mike says:

    I too was annoyed with the useless VPN Action Button. Is there any change to use the VPN button as a toggle for a single VPN connection? I only have 1 VPN and I rarely see my desktop so using a desktop shortcut could be just as many clicks as the Windows 10 way of connecting to VPN. It would be nice to click that Action Button and have it connect to my only VPN.

  5. Tim says:

    Are you sure about this? I’m using the “rasdial” method on Windows 10 Home, and it is definitely using the stored VPN credentials, not the Windows ones. In fact, if the VPN has no stored credentials it fails to connect using rasdial. I have to connect once via the GUI to enter the credentials, then once they are stored the rasdial shortcut works.

    • Shiftkey says:

      No, it was just an assumption and I have not investigated it further. The assumption was based on that it was the only machine that was using a microsoft account for login, where the others used a local account (that matched the credentials for the vpn). So it could be something else. It think is also possible that it was a glitch that Microsoft has fixed since then. Anyway good to hear it is working for you. Perhaps I should try it again!

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: