Add Vpn With Powershell

From time to time is easier to write script for configuration as mouse clicking.

Add Vpn With Powershell
Photo by Rory Hennessey / Unsplash

Ok when you need to configure vpn on more PC is easier to do this with powershell than with mouse clicking ... Here it is example for L2TP oveer IPSec.

Add-VpnConnection -Name "<vpn-name>" -ServerAddress "<address-to-your-server>" -TunnelType "L2tp" -AuthenticationMethod Chap,MSChapv2,Pap -L2tpPsk "<your-psk>"

or create script for it so you don't need to remmer all that options.

Then all what you need to do is call your script:

.\add-l2tp.ps1 -name "My VPN" -server "" -psk "mySu9erS3cr3tPSK"