Adding Windows DNS Records Via Command-Line

By | May 23, 2013

This is something that is almost completely off-topic, but something I've found myself doing quite a bit at Enkitec.  You see, we keep adding new hardware (Big Data Appliance in August, new Exadata X3-2 earlier this year), and that means that we need to add a bunch of DNS entries at once.  Even an eighth rack of Exadata needs 54 DNS entries, when you add up the forward and reverse records.

If you're like us, you have a Windows-based DNS server (whether you like it or not).  The DNS configuration interface in Windows Server 2008 is pretty nice, but it can be a pain to repeatedly click to add all of the entries needed.  What is really convenient is to be able to write out the commands and paste them into a command line window.  Since I use this blog as a place to keep things that I'll use again, I wanted to document this here.  Someday, you may find this useful, too.  I know that real men use Linux for DNS, but unfortunately, we were unable to resist the pull of Active Directory (ugh).

First, you'll need to add your A records - these are the normal DNS entries (forward lookups).

dnscmd . /RecordAdd {domain} {hostname} {record type} {IP address}

Next, you'll need to add the PTR records - these are reverse lookups (translate an IP into a hostname)

dnscmd . /RecordAdd {reverse domain name} {last octet of IP} {record type} {fully qualified hostname}

Here's what this looks like when we put it into action:

C:Usersacolvin>dnscmd . /RecordAdd enkitec.com  enkx3sw-pdua A 192.168.8.245

Add A Record for enkx3sw-pdua.enkitec.com at enkitec.com
Command completed successfully.

C:UsersAdministrator>dnscmd . /recordadd 8.168.192.in-addr.arpa. 245 PTR enkx3sw-pdua.enkitec.com

Add PTR Record for 245.8.168.192.in-addr.arpa. at 8.168.192.in-addr.arpa.
Command completed successfully.

I know that real men use Linux (and manlier men use BSD) for DNS, but unfortunately, we were unable to resist the pull of Active Directory (ugh).

5 thoughts on “Adding Windows DNS Records Via Command-Line

    1. Andy Colvin Post author

      I definitely need to look at dnsmasq – Oracle uses it on the BDA, and I’ve been told numerous times that I need to check it out. Unfortunately, we have to use active directory in our office – we managed to hold out on a windows server until about 2 years ago – and I don’t want to have to maintain 2 different DNS infrastructures. Thankfully, the windows DNS server will still replicate to our servers running BIND without issue.

      Reply
  1. jason arneil

    I can actually provide some confirmation that manlier men use BSD for DNS. I used to work for the tld provider for .uk, and yes there were BSD nameservers.

    Boy was I dancing for joy the day the BSD nameservers were retired!

    Reply

Leave a Reply to Andy Colvin Cancel reply

Your email address will not be published.