Connect to a network via the command line

1

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.

justasking

Posted 2010-04-04T03:21:13.293

Reputation:

2What 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 – 2010-04-04T04:16:15.180

Answers

1

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

Anders Abel

Posted 2010-04-04T03:21:13.293

Reputation: 391

1

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.

bsdfm

Posted 2010-04-04T03:21:13.293

Reputation: 11