Easily change DNS servers for computers with static IP addresses using PowerShell. Run locally or remote.

Changing DNS servers

Recently I provisioned new domain controllers as part of a migration from a 2008 R2 Active Directory forest to a 2016 Active Directory forest. Like the existing 2008 R2 domain controllers, the new domain controllers are configured as AD integrated DNS servers and will be the primary and secondary DNS servers used on the internal network.

Changing DNS servers for clients using DHCP is a trivial matter; just update Option 6 for the DHCP scope with the new name server IP addresses and restart the client (or wait until they renew their lease).

However if you are like a lot of environments, you have Windows servers and maybe even workstations configured with static IP addresses and static DNS servers. How can you systematically update these configurations?

The second post in my PowerShell Beginner series, “Daily Tasks, The PowerShell Way“. Learn how to get network connection information and configure a static IP or DHCP using PowerShell.

Are you connected?

In my previous post we covered how to use Test-NetConnection for network connectivity troubleshooting. If you connected to a DHCP enabled network, you will likely have successful tests without any action on your part. However, if your network environment requires static configuration of IP addresses and DNS servers for servers and/or workstations, you need to configure the correct network settings for a newly provisioned computer.

The first post in my PowerShell Beginner series “Daily Tasks, The PowerShell Way“, get started with PowerShell by replacing some classic but obsolete command line tools such as ping.exe, tracert.exe, and more by using Test-NetConnection.

How to start using PowerShell?

There is SO much one can do with PowerShell, often one of the questions is where to start. Why not with tasks you are likely to perform once if not multiple times daily? This is the first post in a PowerShell Beginner series aimed at highlighting tasks that you may currently be doing by GUI or old command line tools and showing how to do them the PowerShell way.