Microsoft dhcp not updating dns records

27 Mar

I want to share a little script I built that will add/update Host Records fed from a CSV file.In the past automating this kind of thing was possible using a combination of WMI and VBS/Powershell and or batch scripting and using the famous DNSCMD.I found myself lately working more and more with the Powershell V3, available in Windows Server 2012, and the new “goodies” it brings.Among those goodies there’s a DHCPServer module, so we can finally breathe a sigh of relief, we can dump netsh and any VBS kludges used to manage DHCP!If there are missing entries, you likely have your DHCP missing one of two settings: This is required if you have DHCP installed on a Domain Controller.It is an issue on Server 2000, 2003, 2008, 2008R2, Server 2012, Server 2012 R2 and will likely be an issue in the newer builds.

Please check this answer, this will provide a method to add your host to any DNS server.

As you can see, all the script needs is a CSV file with 2 columns called “hostname” and IP, containing the FQDN, and the DNS server you want to connect and make the changes.

Lines 17-18: This is where we’re extracting the short DNS name from the FQDN and the DNS zone name.

It has been a busy time for me lately, but I’m back here to write about a script to Report on some basic DHCP scope settings.

In my situation I used this script to find out which DHCP scopes had specific DNS servers configured, DNS servers that we planned to decommission, so it made sense to replace the IP addresses with valid ones.