Created
July 12, 2019 14:59
-
-
Save davejlong/1e242e2543aa6f4e51c63f9bd89090aa to your computer and use it in GitHub Desktop.
Creates a new L2TP VPN Connection (written for Atera RMM)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### | |
# Author: Dave Long <dlong@cagedata.com> | |
# Created: 2019-07-12 | |
# Last Modified: 2019-07-12 # Create function | |
# | |
# Creates a VPN connection for connecting to an L2TP VPN server | |
### | |
function Add-L2TPVpnConnection { | |
param( | |
[string]$Name, | |
[string]$ServerAddress, | |
[string]$Psk | |
) | |
# Don't try to recreate the same VPN again. | |
if (Get-VPNConnection | Where-Object Name -eq $Name) { return $true } | |
Add-VpnConnection -Name $Name -ServerAddress $ServerAddress -TunnelType L2tp -L2tpPsk $Psk -EncryptionLevel Required -AuthenticationMethod MSChapv2 -RememberCredential -AllUserConnection -Force | |
} | |
Add-L2TPVpnConnection -Name "{[ConnectionName]}" -ServerAddress "{[ServerAddress]}" -Psk "{[PreSharedKey]}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment