Disconnect VPN Using the Command Line

21,836

Check out Rasdial (part of Windows):

USAGE:

    rasdial entryname [username [password|*]] [/DOMAIN:domain]
            [/PHONE:phonenumber] [/CALLBACK:callbacknumber]
            [/PHONEBOOK:phonebookfile] [/PREFIXSUFFIX]

    rasdial [entryname] /DISCONNECT

    rasdial

So to hang up a vpn named 'The VPN' it'd be:

c:\>rasdial "The VPN" /DISCONNECT

HTH

Share:
21,836

Related videos on Youtube

Dave Johnson
Author by

Dave Johnson

Software developer specializing in Microsoft .NET (C#, ASP.NET)

Updated on September 17, 2022

Comments

  • Dave Johnson
    Dave Johnson over 1 year

    I make VPN connections using Vista's Connection Manager, and would like to disconnect the VPN connection from the command line so I can create a shortcut command called vpn.disconnect in Promptu Launcher.

    How can I disconnect the VPN connection via the command line?

  • Dave Johnson
    Dave Johnson about 14 years
    Works great - thanks for your help! I would upvote your answer too, but I don't quite have enough points yet.
  • derGral
    derGral almost 12 years
    Using it with no entryname appears to disconnect everything; e.g. rasdial /DISCONNECT