From add22be68b4eb8ee0a273a47218b07b2f993acac Mon Sep 17 00:00:00 2001 From: Chris Long Date: Sat, 13 Jun 2020 21:47:59 -0700 Subject: [PATCH 1/3] Update create-domain.ps1 Don't change DNS settings for azure provisioning --- Vagrant/scripts/create-domain.ps1 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Vagrant/scripts/create-domain.ps1 b/Vagrant/scripts/create-domain.ps1 index 0cef2c3..cf3b0c1 100644 --- a/Vagrant/scripts/create-domain.ps1 +++ b/Vagrant/scripts/create-domain.ps1 @@ -46,10 +46,12 @@ if ((gwmi win32_computersystem).partofdomain -eq $false) { -Force:$true $newDNSServers = "127.0.0.1", "8.8.8.8", "4.4.4.4" + $adapters = Get-WmiObject Win32_NetworkAdapterConfiguration | Where-Object { $_.IPAddress -And ($_.IPAddress).StartsWith($subnet) } if ($adapters) { Write-Host "$('[{0:HH:mm}]' -f (Get-Date)) Setting DNS" - $adapters | ForEach-Object {$_.SetDNSServerSearchOrder($newDNSServers)} + # Don't do this in Azure. If the network adatper description contains "Hyper-V", this won't apply changes. + $adapters | ForEach-Object if (!($_.Description).Contains("Hyper-V")) {$_.SetDNSServerSearchOrder($newDNSServers)} } Write-Host "$('[{0:HH:mm}]' -f (Get-Date)) Setting timezone to UTC" c:\windows\system32\tzutil.exe /s "UTC" From f8cc4a9ec72df9f3ae56ffb84ff866f5ff17a3bb Mon Sep 17 00:00:00 2001 From: Chris Long Date: Sat, 13 Jun 2020 21:49:41 -0700 Subject: [PATCH 2/3] Update join-domain.ps1 --- Vagrant/scripts/join-domain.ps1 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Vagrant/scripts/join-domain.ps1 b/Vagrant/scripts/join-domain.ps1 index 70579e4..3e36631 100755 --- a/Vagrant/scripts/join-domain.ps1 +++ b/Vagrant/scripts/join-domain.ps1 @@ -6,7 +6,8 @@ Write-Host "$('[{0:HH:mm}]' -f (Get-Date)) Joining the domain..." Write-Host "$('[{0:HH:mm}]' -f (Get-Date)) First, set DNS to DC to join the domain..." $newDNSServers = "192.168.38.102" $adapters = Get-WmiObject Win32_NetworkAdapterConfiguration | Where-Object {$_.IPAddress -match "192.168.38."} -$adapters | ForEach-Object {$_.SetDNSServerSearchOrder($newDNSServers)} +# Don't do this in Azure. If the network adatper description contains "Hyper-V", this won't apply changes. +$adapters | ForEach-Object {if (!($_.Description).Contains("Hyper-V")) {$_.SetDNSServerSearchOrder($newDNSServers)}} Write-Host "$('[{0:HH:mm}]' -f (Get-Date)) Now join the domain..." $hostname = $(hostname) From dfa0a09d433026bed731cd67688bfe968bdcd8f4 Mon Sep 17 00:00:00 2001 From: Chris Long Date: Sat, 13 Jun 2020 21:50:00 -0700 Subject: [PATCH 3/3] Update create-domain.ps1 --- Vagrant/scripts/create-domain.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Vagrant/scripts/create-domain.ps1 b/Vagrant/scripts/create-domain.ps1 index cf3b0c1..01220c7 100644 --- a/Vagrant/scripts/create-domain.ps1 +++ b/Vagrant/scripts/create-domain.ps1 @@ -51,7 +51,7 @@ if ((gwmi win32_computersystem).partofdomain -eq $false) { if ($adapters) { Write-Host "$('[{0:HH:mm}]' -f (Get-Date)) Setting DNS" # Don't do this in Azure. If the network adatper description contains "Hyper-V", this won't apply changes. - $adapters | ForEach-Object if (!($_.Description).Contains("Hyper-V")) {$_.SetDNSServerSearchOrder($newDNSServers)} + $adapters | ForEach-Object {if (!($_.Description).Contains("Hyper-V")) {$_.SetDNSServerSearchOrder($newDNSServers)}} } Write-Host "$('[{0:HH:mm}]' -f (Get-Date)) Setting timezone to UTC" c:\windows\system32\tzutil.exe /s "UTC"