How to Update DNS Server IP Addresses on Clients Through PowerShell
Every so often I have to upgrade domain controllers. Easy, build a new server, and migrate services. But, what if you have 10s or 100s of servers with statically assigned IPs that you need to update their DNS settings to point to the new domain controllers? The answer, PowerShell.
This script searches your existing network interfaces for one of the pre-existing DNS servers, then will update the DNS servers with whatever you provide.
$dnsOldServer is the old DNS server address you are searching for. $dnsNewPrimary and $dnsNewSecondary are the new DNS server IP addresses you want to use. The script will review each network interface and search for $dnsOldServer. If it is found, the DNS server IPs will be updated with what you provide.