Skip to content

Instantly share code, notes, and snippets.

@puttyq
Created August 3, 2018 11:03
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save puttyq/eac6414f92724446711c0ab2fb713394 to your computer and use it in GitHub Desktop.
Save puttyq/eac6414f92724446711c0ab2fb713394 to your computer and use it in GitHub Desktop.
Creating and connecting to a Windows built-in L2TP VPN Connection
# Get All VPN Connections
Get-VpnConnection
# Create VPN Connection to Office L2TP
Add-VpnConnection -Name "Test" `
-ServerAddress "xxxxxxxxxx" `
-TunnelType L2TP `
-L2tpPsk "xxxxxxxxxxxx" `
-EncryptionLevel Optional `
-AuthenticationMethod MsChapv2 `
-SplitTunneling -Force
#Delete a VPN Connection
Remove-VpnConnection "Office VPN Connection" -Force
#Dail a VPN Connection
rasdail.exe "Test" user password
#Close a VPN connection
rasdail.exe "Test" /Disconnect
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment