How to add a DNS entry through command line in Windows....

Posted on 2006-07-13
Last Modified: 2010-01-11
Hi ,

I would like to add DNS entry for the windows client machine, is there any command line utility where i can add the entry...
If any of you guys plz let me know.

Thanks inadvance,
Question by:Mohan Shivaiah
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
LVL 57

Expert Comment

by:Pete Long
ID: 17097700
Hi mohan_sh,
DNS Scripting
or if its just a couple of records

You can use dnscmd.exe which is part of support tools to add a A record.
The syntax is like

dnscmd.exe dnsserver /recordadd zonename hostname A ipaddress

LVL 57

Expert Comment

by:Pete Long
ID: 17097712
dnscmd PRIMARY /recordadd contoso.COM @ A
//sets up the record on the primary server for contoso.COM pointing to the IP

LVL 57

Accepted Solution

Pete Long earned 20 total points
ID: 17097728
From Batch FIle



The BAT file creates a series of record into DNS.
It uses as input the file LISTA.TXT. In this file you have
to specify the name of the record and the value that
it wil have.

IF you open the BAT file you'll see that you have
to specify also after DNSCMD a server that contain
the zone (SERVERNAME) the parameter /RecordADD, to add the
record and the ZONE where you want to add the record.

You can also specify if the record you want to add
is an HOST or an ALIAS. To do so you have to put
beetween the RECORD_NAME; and the value XXX.XXX.XXX.XXX or alias the value:


so the result of the string inside the input.txt result:





for /f "tokens=1-3 delims=;" %%a in (input.txt) do (
dnscmd SERVERNAME /RecordAdd ZONE_WHERE_ADD_RECORD %%a %%b %%c >>insert.log)

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Trying to figure out group policy inheritance and which settings apply where can be a chore.  Here's a very simple summary I've written which might help.  Keep in mind, this is just a high-level conceptual overview where I try to avoid getting bogge…
I'm a big fan of Windows' offline folder caching and have used it on my laptops for over a decade.  One thing I don't like about it, however, is how difficult Microsoft has made it for the cache to be moved out of the Windows folder.  Here's how to …
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor ( Top Charts is a view in which you can set seve…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question