Powershell VPN connections - PEAP with MSCHAPv2



Messing around with VPNs last week I found that it is easier (sometimes) to have a one liner for VPN creation!

Here's how I make a PEAP\MSChapV2 VPN profile...using the users Windows creds!

Change ServerAddress, DnsSuffix and choose a better L2tpPsk!!

$a = New-EapConfiguration -UseWinlogonCredential
$b = New-EapConfiguration -Peap -TunnledEapAuthMethod $a.EapConfigXmlStream
Add-VpnConnection -Name "VPN (SSL)" -ServerAddress vpn.fqdn.com -AuthenticationMethod Eap -DnsSuffix my.domain.com -EapConfigXmlStream $b.EapConfigXmlStream -EncryptionLevel Maximum -Force -RememberCredential -AllUserConnection -TunnelType Sstp
Add-VpnConnection -Name "VPN (L2TP)" -ServerAddress vpn.fqdn.com -AuthenticationMethod Eap -DnsSuffix my.domain.com -EapConfigXmlStream $b.EapConfigXmlStream -EncryptionLevel Maximum -Force -RememberCredential -AllUserConnection -TunnelType L2tp -L2tpPsk "shared secret key"


Comments

Popular posts from this blog

PXE booting, MDT and 802.1x

Intune installation requires a wire...or does it?