Windows – Disconnect VPN Using the Command Line

command lineconnectionvpnwindows-vista

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?

Best Answer

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