Solved

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

Posted on 2006-07-13
5
11,282 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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

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 …
Have you ever set up your wireless router at home or in the office to find that you little pop-up bubble in the bottom right-hand corner of Windows read "IP Conflict - One of more computers on the network have been assigned the following IP address"…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

786 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