Update join-domain.ps1
This commit is contained in:
@@ -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..."
|
Write-Host "$('[{0:HH:mm}]' -f (Get-Date)) First, set DNS to DC to join the domain..."
|
||||||
$newDNSServers = "192.168.38.102"
|
$newDNSServers = "192.168.38.102"
|
||||||
$adapters = Get-WmiObject Win32_NetworkAdapterConfiguration | Where-Object {$_.IPAddress -match "192.168.38."}
|
$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..."
|
Write-Host "$('[{0:HH:mm}]' -f (Get-Date)) Now join the domain..."
|
||||||
$hostname = $(hostname)
|
$hostname = $(hostname)
|
||||||
|
|||||||
Reference in New Issue
Block a user