How to connect/disconnect to a VPN using the command line?


  1. Posts : 4
    Windows 10 Pro 64bit
       #1

    How to connect/disconnect to a VPN using the command line?


    Hi all

    I have several network connections configured.

    • There is one wifi connection which automatically connects to my WLAN,
    • another cable based LAN connection to a NAS which is used for backups
    • and some L2TP connection connections (used for VPN if needed).


    Is there a way to connect to these VPNs via the command line (so that I can have a "Batch" File which starts or stops this connection)? I already tried to find something but havent found a solution.
      My Computer


  2. Posts : 2
    windows 10 64
       #2

    rasdial now broken in windows 10


    it might be that i need to install some additional windows features now i upgraded to 10 but previously this rasdial command line worked for me to do this

    C:\Windows\System32\rasdial.exe "VPNname"

    EcoGex said:
    Hi all

    I have several network connections configured.

    • There is one wifi connection which automatically connects to my WLAN,
    • another cable based LAN connection to a NAS which is used for backups
    • and some L2TP connection connections (used for VPN if needed).


    Is there a way to connect to these VPNs via the command line (so that I can have a "Batch" File which starts or stops this connection)? I already tried to find something but havent found a solution.
      My Computer


  3. Posts : 4
    Windows 10 Pro 64bit
    Thread Starter
       #3

    lucasrenzi said:
    it might be that i need to install some additional windows features now i upgraded to 10 but previously this rasdial command line worked for me to do this

    C:\Windows\System32\rasdial.exe "VPNname"
    Does not work here. Says there is an incorrect combination of username and/or password.
    But they are working if started via control panel.
      My Computer


  4. Posts : 2
    windows 10 64
       #4

    EcoGex said:
    Does not work here. Says there is an incorrect combination of username and/or password.
    But they are working if started via control panel.
    Seems the username and password saved in control panel isnt used by rasdial in command prompt. instead you need to put the user/pass into the command line:

    C:\Windows\System32\rasdial.exe "VPN" "username" "password"
    use the same command with /disconnect to switch it off
      My Computer


  5. Posts : 2
    Win 10 Home
       #5

    lucasrenzi said:
    C:\Windows\System32\rasdial.exe "VPN" "username" "password"
    Tried this cmd but no luck:
    Remote Access error 703 - The connection needs information from you, but the application does not allow user interaction.

    For more help on this error:
    Type 'hh netcfg.chm'
    In help, click Troubleshooting, then Error Messages, then 703
    What I'm doing wrong?
      My Computer


  6. Posts : 4
    Windows 10 Home
       #6

    lucasrenzi said:
    Seems the username and password saved in control panel isnt used by rasdial in command prompt. instead you need to put the user/pass into the command line:

    C:\Windows\System32\rasdial.exe "VPN" "username" "password"
    use the same command with /disconnect to switch it off
    Thank you vary much. Both commands work flawlessly in Win 10 Pro last updated on 12th April 2017.
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 03:35.
Find Us




Windows 10 Forums