Add Multiple IP Addresses to DNS

A new project was put in place to upgrade our VOIP system.  This involved contracting with a new managed service provider.  The provider built 50 new VMware hosts in two redundant locations resulting in 50 new IP addresses to be added to DNS.

Adding multiple IP addresses to DNS can take a long time if done one by one.  PowerShell to the rescue!  Below are the steps I took to quickly add the new servers to DNS.

First, I created a .csv file with the server names, IP adresses and the zone to which they would be added.

Example .csv file entries below:

Hostname,IPaddress,Zone
server01,192.168.0.1,domain.com
server02,192.168.0.2,domain.com

Then I ran the PowerShell code below which added the server IP Addresses to DNS along with their PTR records.

Import-CSV -Path D:\Scripts\DNSimport.csv | ForEach-Object {dnscmd DNSSERVER01 /RecordAdd $_.Zone $_.HostName /CreatePTR A $_.IPaddress}

Note:  You will need to have the DNS management tools installed for this command.