Solved

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

Posted on 2006-07-13
5
11,280 Views
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,
MC.
0
Comment
Question by:Mohan Shivaiah
  • 3
5 Comments
 
LVL 57

Expert Comment

by:Pete Long
ID: 17097700
Hi mohan_sh,
DNS Scripting http://www.windowsitpro.com/Article/ArticleID/37719/37719.html
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

Cheers!
0
 
LVL 57

Expert Comment

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

see http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/9dec9c21-27d1-4781-9ef8-6555a804a79f.mspx?mfr=true
0
 
LVL 57

Accepted Solution

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

From
http://cwashington.netreach.net/dep...iptType=command

Script:

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:

A = HOST
CNAME = ALIAS

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

RECORD_2_ADD;A;IP_ADDRESS

OR

RECORD_2_ADD;CNAME;ALIAS_WHERE_POINT


BATCH FILE:
********

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

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Nslookup is a command line driven utility supplied as part of most Windows operating systems that can reveal information related to domain names and the Internet Protocol (IP) addresses associated with them. In simple terms, it is a tool that can …
Are you one of those front-line IT Service Desk staff fielding calls, replying to emails, all-the-while working to resolve end-user technological nightmares? I am! That's why I have put together this brief overview of tools and techniques I use in o…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

863 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now