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"

into

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.


Reacties

10 reacties op “Quickly connect to a VPN on Windows 10 (revisited)”

  1. Thank you so much. You save my life! ๐Ÿ™‚

    1. Hi Paulo, you’re welcome! ๐Ÿ™‚

  2. Hiya,
    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. 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: \\192.168.137.2\Zeus /persistent:no /user:admin XXXXX
    Echo Y:
    NET USE Y: \\192.168.137.2\Swap /persistent:no /user:admin XXXXX
    Echo D:
    NET USE D: \\192.168.137.1\D /persistent:no /user:XXXXX YYYYYY
    Echo VPN
    rasdial 3 USERNAME PASSWORD
    Echo Done. Bye.
    wait 5
    cls

    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.

    1. Hi Ndi, thanks, that is correct. As described, in my case I specifically did not want to store my username and password in plain text in a file! So I continued looking for another trick. But if the plain text password is not a problem in your situation, then your script will work fine.

      1. I’m not a developer, so can’t vouch for its security, but bat2exe might be what you need to hide the password.
        https://bat2exe.codeplex.com/

      2. Or perhaps this one: http://bat2exe.net/ which doesn’t make you press the any key to close at the end.

  4. 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. 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.

    1. 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

Je e-mailadres wordt niet gepubliceerd. Vereiste velden zijn gemarkeerd met *