Have you ever installed a new Domain Controller and want to add this to all Member Windows Servers?
I had that problem so I created a small script that looked up all NIC with a “known” DNS server and added set the correct ones.
foreach ($server in $servers) {
Invoke-Command -ComputerName $server -ScriptBlock {
get-DnsClientServerAddress | where {$_.ServerAddresses -contains “10.28.124.11” -AND $_.interfaceAlias -notmatch “isatap”} | Set-DnsClientServerAddress -ServerAddresses (“10.28.124.11”, “10.28.124.111”, “10.28.124.12”)
}
}
What it does is connects to all servers in nthe “servers”-variable and seeks for all interfaces that has a known dans-server-IP. After that it sets all the wanted DNS-server on the interface.