Change VPN in Windows 7 from command line

2

2

How can I change my VPN connection settings in Windows 7 from the command line? I know how to do it using the GUI but I really need to do it from the console.

I need to change the user, password and internet address and then restart the connection. It doesn't matter if I have to install some third-party software in order to do this (from the command line).

Ivan Castellanos

Posted 2012-04-13T20:10:31.420

Reputation: 404

What sort? PPTP? – paradroid – 2012-04-13T23:02:06.293

Ups... yes, PPTP. – Ivan Castellanos – 2012-04-14T06:23:53.687

Answers

3

I was able to do it with the rasdial command

rasdial /disconnect
rasdial connection_name user pass /phone:host.example.com

Source: Microsoft resources and some guy.

Ivan Castellanos

Posted 2012-04-13T20:10:31.420

Reputation: 404

3

I have not got a PPTP connection set up to test this at the moment, but you could try making two connections in %userprofile%\AppData\Roaming\Microsoft\Network\Connections\Pbk\. The default connection is rasphone.pbk.

You could just execute them using the full path from the commmand line, but I am not sure if the first one automatically disconnects when you use the second one, as I cannot test it.

paradroid

Posted 2012-04-13T20:10:31.420

Reputation: 20 970

1Your comment pointed me in the right direction but it was not an accurate solution for my problem. – Ivan Castellanos – 2012-04-15T22:41:22.113

@IvanCastellanos: That's okay - I didn't expect it to be. – paradroid – 2012-04-16T00:00:10.080