Connect to L2TP/IPsec (username/password/PSK) on cmd.exe

1

How may I connect to VPN using the username, password and PSK combo in the command line? Google has been of no help; any guidance will be most welcome.

I want a command to the effect of vpnclient /server domain.tld /username u /password p /psk k if at all possible. (I want to run it as part of a script on multiple systems)

Oxwivi

Posted 2015-10-10T08:37:10.230

Reputation: 312

If you're happy to use PowerShell, this page might be useful.

– Bob – 2015-10-10T10:17:54.290

Otherwise, it looks like rasdial is the legacy command. – Bob – 2015-10-10T10:19:29.227

1

Possible duplicate of Change VPN in Windows 7 from command line

– Bob – 2015-10-10T10:20:40.673

@Bob I want a command to the effect of vpnclient /server domain.tld /username u /password p /psk k if at all possible. (I want to run it as part of a script on multiple systems) Would you happen to know any commands that'll let me do so? – Oxwivi – 2015-10-10T10:24:55.480

That's basically what rasdial does, albeit with an existing connection. Something like rasdial entryname username password - you might be able to create a portable pbk file and specify it with /phonebook:phonebookfile. As for PSK... read the further reading links. You might be able to add it to the phonebook file. You can probably create the entry with the GUI and copy it from %AppData%\Microsoft\Network\Connections\Pbk

– Bob – 2015-10-10T10:28:02.773

@Bob, if you'll put those step-by-step in an answer, I'll accept it. But do add opening the pbk file and adding the PSK to the already present line. It isn't saved by default for some reason. – Oxwivi – 2015-10-11T15:48:11.557

No answers