I can easily create a VPN connection through the PowerShell command Add-VpnConnection
, however it doesn't seem able to specify any credentials (there is no option to specify username/password). As a workaround I tried to use -RememberCredential
option in Add-VpnConnection
and to pass the credentials by forcing a connection through rasdial command, yet even though the connection succeeds Windows doesn't save the credentials :(
Add-VpnConnection -Name xxxxx ...
rasdial xxxxx user password
rasdial xxxxx /disconnect
Is it possible some way ?
Maybe it is too late, but I had same task and here is solution: