<#
DESCRIPTION: Setup VPN Connection on Windows Computers. Can be run from Datto for each Windows client.

#>

$Settings = @{
    name                  = "HCH-VPN"
    ServerAddress         = "mail.hchent.com"
    AllUserConnection     = $true
    TunnelType            = "L2TP"
    L2tpPsk               = "meraki"
    AuthenticationMethod  = "Pap"
}

$VPN = Get-VPNconnection -name $($Settings.name) -AllUserConnection -ErrorAction SilentlyContinue
if (!$VPN) {
	#Get-VPNConnection -AllUserConnection | Remove-VpnConnection -force
	#Get-VPNConnection | Remove-VpnConnection -force
	
    Add-VPNconnection @Settings -force
}
else {
    Set-VpnConnection @settings -Verbose
}