## This is executed in the computers/system/administrator contextRemove-VpnConnection -Name "Contoso VPN" -Force# If the Windows Logon is the same as the logon to the VPN you can use -UseWinlogonCredential - otherwise remove# To allow connecting before logon add -AllUserConnectionAdd-VpnConnection -Name "Contoso VPN" -ServerAddress "vpn.contoso.com" -EncryptionLevel "Required" -SplitTunneling -AllUserConnection -UseWinlogonCredential# See https://wiki.strongswan.org/projects/strongswan/wiki/SecurityRecommendationsSet-VpnConnectionIPsecConfiguration -ConnectionName "Contoso VPN" -AuthenticationTransformConstants GCMAES256 -CipherTransformConstants GCMAES256 -DHGroup ECP256 -EncryptionMethod GCMAES256 -IntegrityCheckMethod SHA256 -PfsGroup ECP256 -Force# Split DNSAdd-VpnConnectionTriggerDnsConfiguration -ConnectionName "Contoso VPN" -DnsSuffix "test" -DnsIPAddress "10.20.30.1"Add-VpnConnectionTriggerDnsConfiguration -ConnectionName "Contoso VPN" -DnsSuffix "contoso.com" -DnsIPAddress "10.20.30.1"# DNS search domains - seems not to workSet-VpnConnectionTriggerDnsConfiguration -ConnectionName "Contoso VPN" -DnsSuffixSearchList "service.prd.contoso.com","node.prd.contoso.com","service.dev.contoso.com","node.dev.contoso.com","node.tst.contoso.com","dc1.contoso.com","ad.contoso.com","muc.contoso.com" -Force# Split Tunneling - See https://wiki.strongswan.org/projects/strongswan/wiki/ForwardingAndSplitTunneling# If there are further networks to be tunneled they have to be added here and this has to be executed again.Add-VpnConnectionRoute -ConnectionName "Contoso VPN" -DestinationPrefix 10.0.0.0/8Add-VpnConnectionRoute -ConnectionName "Contoso VPN" -DestinationPrefix 173.194.0.0/16Add-VpnConnectionRoute -ConnectionName "Contoso VPN" -DestinationPrefix 64.233.160.0/19Add-VpnConnectionRoute -ConnectionName "Contoso VPN" -DestinationPrefix 172.217.0.0/16# To allow for using hostnames onlySet-DnsClientGlobalSetting -SuffixSearchList @("service.prd.contoso.com","node.prd.contoso.com","service.dev.contoso.com","node.dev.contoso.com","node.tst.contoso.com","dc1.contoso.com","ad.contoso.com","muc.contoso.com")