This might take you < 1 minutes to read.

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 “” -AND $_.interfaceAlias -notmatch “isatap”} | Set-DnsClientServerAddress -ServerAddresses (“”, “”, “”)

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.