Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I want to be able to connect to a network via command line in Windows. My goal is to script out remoting into my work computer. I hate having to always manually connect to the VPN connection and then rdping into my work machine. I want to just have a script which will do both of it for me. I know how to rdp via command line, I just need to know how to connect to my VPN via command line.

share|improve this question

migrated from stackoverflow.com Apr 4 '10 at 3:31

This question came from our site for professional and enthusiast programmers.

2  
What VPN software are you using? There may be different ways to control the VPN connection from the command line based on the software (Cisco, OpenVPN, etc). –  Matrix Mole Apr 4 '10 at 4:16

2 Answers 2

Have you looked at the netsh command which can be used to control the network in many ways?

share|improve this answer

If you are using a microsoft VPN, the built-in command you are looking for is "rasdial". As far as I can tell, netsh won't help.

After you've set up your VPN connection, use

rasdial <VPNName> <username> *

to request a password and initiate the connection. Unfortunately, I don't know a way to use the password saved via the GUI. Then use

rasdial <VPNName> /DISCONNECT

to end the connection. For other options, of course use rasdial /?

If you aren't using the built-in Microsoft VPN drivers, then you will need to use a command line utility specific to your VPN vendor.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.