Unify Windows client bootstrap and discover network paths

This commit is contained in:
2026-09-10 08:13:46 -06:00
parent 74235ec6f8
commit 7f8a9eed4e
14 changed files with 634 additions and 219 deletions
+15 -11
View File
@@ -65,7 +65,9 @@ try {
if ($existingConnection) {
Remove-VpnConnection -Name $ConnectionName -AllUserConnection -Force
}
Add-VpnConnection `
$dnsParameters = @{}
if ($DomainName) { $dnsParameters.DnsSuffix = $DomainName }
Add-VpnConnection @dnsParameters `
-Name $ConnectionName `
-ServerAddress $vpnServer `
-TunnelType Ikev2 `
@@ -75,22 +77,24 @@ try {
-EncryptionLevel Required `
-SplitTunneling `
-AllUserConnection `
-DnsSuffix $DomainName `
-Force | Out-Null
foreach ($prefix in $AzureNetworkPrefixes) {
Add-VpnConnectionRoute -ConnectionName $ConnectionName `
-DestinationPrefix $prefix -AllUserConnection -PassThru | Out-Null
}
$nrptDisplayName = "SGU Azure P2S DNS - $DomainName"
Get-DnsClientNrptRule -ErrorAction SilentlyContinue |
Where-Object DisplayName -eq $nrptDisplayName |
Remove-DnsClientNrptRule -Force
Add-DnsClientNrptRule `
-Namespace ".$DomainName" `
-NameServers $DomainControllerIPv4Address.IPAddressToString `
-DisplayName $nrptDisplayName `
-Comment 'Managed by SGU Azure P2S bootstrap; routes only the AD namespace to the domain controller.' | Out-Null
# The unified bootstrap can discover the domain after connecting.
if ($DomainName) {
$nrptDisplayName = "SGU Azure P2S DNS - $DomainName"
Get-DnsClientNrptRule -ErrorAction SilentlyContinue |
Where-Object DisplayName -eq $nrptDisplayName |
Remove-DnsClientNrptRule -Force
Add-DnsClientNrptRule `
-Namespace ".$DomainName" `
-NameServers $DomainControllerIPv4Address.IPAddressToString `
-DisplayName $nrptDisplayName `
-Comment 'Managed by SGU Azure P2S bootstrap; routes only the AD namespace to the domain controller.' | Out-Null
}
}
if ($Connect) {