Solved

DNSadd and DNS delete commands

Posted on 2011-02-27
4
971 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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Dual boot help 2 34
AD LDS integrated with ADDS question 4 5
Windows 2008 SBS Patch 2 47
Lower the volume for a specific MP3 file 5 40
In this article, I will show you HOW TO: Perform a Physical to Virtual (P2V) Conversion the easy way from a computer backup (image).
There are many software programs on offer that will claim to magically speed up your computer. The best advice I can give you is to avoid them like the plague, because they will often cause far more problems than they solve. Try some of these "do it…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

734 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