2021-03-18 13:21:38 +00:00
|
|
|
# Windows IPsec configurator
|
2021-03-18 13:10:09 +00:00
|
|
|
|
2021-03-18 13:21:38 +00:00
|
|
|
Script to automate VPN connection creation on Windows.
|
|
|
|
|
2024-11-12 17:22:12 +00:00
|
|
|
Connection can be created globally or for the current user by using the
|
2024-11-12 17:23:56 +00:00
|
|
|
*allUsers* parameter, CA certificate must always be installed globally
|
2024-11-12 17:22:12 +00:00
|
|
|
regardless of who the connection is created for.
|
2021-03-18 13:21:38 +00:00
|
|
|
|
2024-11-12 17:22:12 +00:00
|
|
|
To be able to execute the script you have to manually run the following
|
|
|
|
commnand in PowerShell (as administrator).
|
2021-03-18 13:21:38 +00:00
|
|
|
|
|
|
|
```
|
|
|
|
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine
|
|
|
|
```
|
|
|
|
|
|
|
|
To avoid DNS issues because of Windows 10 "smart multi-homed name resolution"
|
2024-11-12 17:22:12 +00:00
|
|
|
VPN connection metric should be set to the lowest one, it is done automatically
|
|
|
|
by the script but it can be done manually from:
|
2021-03-18 13:21:38 +00:00
|
|
|
|
|
|
|
- VPN connection > Properties > Networking > TCP/IPv4 > Properties > Advanced...
|
|
|
|
- Disable "Automatic metric" and set "Interface metric" to 1.
|
|
|
|
|
|
|
|
More info about the issue at:
|
|
|
|
|
|
|
|
- https://superuser.com/questions/966832/windows-10-dns-resolution-via-vpn-connection-not-working
|
|
|
|
|
|
|
|
The EAP XML configuration can be generated from an existing connection using
|
|
|
|
the following commands.
|
|
|
|
|
|
|
|
```
|
|
|
|
$conn = Get-VpnConnection -Name $vpnName
|
|
|
|
$conn.EapConfigXmlStream.InnerXml
|
|
|
|
```
|