From d2b77cf00d054a365cf6d77e9f1d312215e83d4d Mon Sep 17 00:00:00 2001 From: Fabian 'xx4h' Sylvester Date: Mon, 27 Mar 2023 20:05:12 +0200 Subject: [PATCH] Always prefer dns on domain interface Set low interface metric for domain interface. fixes #801 --- Vagrant/scripts/join-domain.ps1 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Vagrant/scripts/join-domain.ps1 b/Vagrant/scripts/join-domain.ps1 index 7683ba044..196e731c0 100755 --- a/Vagrant/scripts/join-domain.ps1 +++ b/Vagrant/scripts/join-domain.ps1 @@ -12,6 +12,9 @@ $adapters = Get-WmiObject Win32_NetworkAdapterConfiguration | Where-Object {$_.I # Specify the DC as a WINS server to help with connectivity as well $adapters | ForEach-Object {if (!($_.Description).Contains("Hyper-V")) {$_.SetDNSServerSearchOrder($newDNSServers); $_.SetWINSServer($newDNSServers, "")}} +# Ensure dns preference on domain interface through higher interface metrics # fix #801 +Get-NetIPAddress | Where-Object { $_.IPAddress -match "192.168.56." } | Set-NetIPInterface -ifIndex { $_.InterfaceIndex } -InterfaceMetric 10 + Write-Host "$('[{0:HH:mm}]' -f (Get-Date)) Now join the domain..." $hostname = $(hostname) $user = "windomain.local\vagrant"