How can I create a VPN connection with an arbitrary server using an arbitrary protocol in Windows cmd?
Is Powershell an option?
Start Powershell:
powershell
Create the VPN Connection: Add-VpnConnection
Add-VpnConnection [-Name] [-ServerAddress] [-TunnelType {Pptp | L2tp | Sstp | Ikev2 | Automatic}] [-EncryptionLevel {NoEncryption | Optional | Required | Maximum}] [-AuthenticationMethod {Pap | Chap | MSChapv2 | Eap}] [-SplitTunneling] [-AllUserConnection] [-L2tpPsk ] [-RememberCredential] [-UseWinlogonCredential] [-EapConfigXmlStream ] [-Force] [-PassThru] [-WhatIf] [-Confirm]
Edit VPN connections: Set-VpnConnection
Set-VpnConnection [-Name] [[-ServerAddress] ] [-TunnelType {Pptp | L2tp | Sstp | Ikev2 | Automatic}] [-EncryptionLevel {NoEncryption | Optional | Required | Maximum}] [-AuthenticationMethod {Pap | Chap | MSChapv2 | Eap}] [-SplitTunneling ] [-AllUserConnection] [-L2tpPsk ] [-RememberCredential ] [-UseWinlogonCredential ] [-EapConfigXmlStream ] [-PassThru] [-Force] [-WhatIf] [-Confirm]
Lookup VPN Connections: Get-VpnConnection
Get-VpnConnection [[-Name] ] [-AllUserConnection]
Connect: rasdial [connectionName]
rasdial connectionname [username [password | \]] [/domain:domain*] [/phone:phonenumber] [/callback:callbacknumber] [/phonebook:phonebookpath] [/prefixsuffix**]
You can manage your VPN connections with the powershell commands above, and simply use the connection name to connect via rasdial.
The results of Get-VpnConnection can be a little verbose. This can be simplified with a simple Select-Object filter:
Get-VpnConnection | Select-Object -Property Name
More information can be found here: