Solved

DNSadd and DNS delete commands

Posted on 2011-02-27
4
966 Views
Last Modified: 2012-05-11
Hi,
I have been trying to find the exact dnsadd and dnsdel commands - couldn't
Can any one please write the exact dns commands

Above part is most important. But if you can please answer below aswell
If I have a comma saperated text file with three parameters and row delimeter ';'
IP                    Host                record type
101.2.4.3        testserver       A

Can any please write a code - i think can be done in VB
to read the file and execute the dnscmd command?
or can it even be done just by BAT files
Basically if I drop a text file with may be particular extension at dir location.
How can we read the file and create dns records from it
not sure but badly in need of help

Big basket of thanks :)
   
0
Comment
Question by:SameerMirza
[X]
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
  • 2
4 Comments
 
LVL 26

Accepted Solution

by:
farhankazi earned 500 total points
ID: 34994361
Hi Sameer,

Check following batch script if this satisfy your requirement.

You need to change variables (DNSServer, DNSZone) values inside the script. Furthermore you require DNSRecords.txt file where you will list all node names with corresponding IP address (space separated).

Hope this helps!
Farhan



@ECHO OFF
SETLOCAL ENABLEDELAYEDEXPANSION

SET DNSServerIP=192.168.1.1
SET DNSZone=MYDOMAIN.COM.PK
SET RecordType=A

FOR /F "Tokens=1-2" %%A in ('TYPE DNSRecords.txt') DO (
	DNSCmd.exe !DNSServerIP! /RecordAdd !DNSZone! %%A !RecordType! %%B)

Open in new window

0
 
LVL 39

Expert Comment

by:Krzysztof Pytko
ID: 34994719
Have you tried with DNSCMD from Windows Support Tools? Using this tool it's easy and you can simply script all :)

Example:

Create
dnscmd DNSServerName /RecordAdd DNSZoneName HostName RecordType IPAddress

dnscmd mydns01 /RecordAdd mydomain.local testserver A 101.2.4.3

Delete
dnscmd DNSServerName /RecordDelete DNSZoneName HostName RecordType /f

dnscmd mydns01 /RecordDelete mydomain.local testserver A /f

Regards,
Krzysztof

0
 
LVL 39

Expert Comment

by:Krzysztof Pytko
ID: 34994732
@farhankazi: I'm sorry I didn't check your script code :( That I put the same code here

@SameerMirza: please skip my answer

Krzysztof
0
 

Author Closing Comment

by:SameerMirza
ID: 35166614
thanks alot. I am very sorry for late reply :/
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Resolve DNS query failed errors for Exchange
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
This Micro Tutorial will give you a basic overview of Windows DVD Burner through its features and interface. This will be demonstrated using Windows 7 operating system.

756 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