Skip to content

Commit

Permalink
Always prefer dns on domain interface
Browse files Browse the repository at this point in the history
Set low interface metric for domain interface.

fixes clong#801
  • Loading branch information
xx4h committed Mar 27, 2023
1 parent 9819fb0 commit 27a5be1
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Vagrant/scripts/join-domain.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 27a5be1

Please sign in to comment.