Command to Create/Delete bulk DNS Record

By | April 6, 2011

DNSCMD command line tool can be used to create DNS entry, I would like to explain how we can use DNSCMD to create and delete bulk DNS record from text file, creating and deletion bulk DNS entry it very simple if you use this procedure

How to create Bulk DNS record

First we will see the bulk DNS creation, we have to create the A record first (In forward zone) then corresponding PTR record for that A record (In reverse zone), before that we have to create input file, update the input file like below




Command to create Bulk A record (host record)

for /f "tokens=1-3 delims=;" %a in (list.txt) do dnscmd Server Name /RecordAdd %b %a A %c

Command to create Bulk PTR record

for /f "tokens=1-3 delims=;" %a in (list.txt) do for /f "tokens=1-4 delims=." %e in ("%c") do dnscmd Server Name /recordadd %h PTR %a.%b

How to delete Bulk DNS record

Like creation, you have to delete both A as well as corresponding PTR records to completely delete the DNS entry, you can use the similar input file

Command to delete Bulk A record

for /f "tokens=1-3 delims=;" %a in (list.txt) do dnscmd Server Name /RecordDelete %b %a A /f

Command to delete Bulk PTR record

for /f "tokens=1-3 delims=;" %a in (list.txt) do for /f "tokens=1-4 delims=." %e in ("%c") do  do dnscmd Server Name /RecordDelete %h PTR /f

Note: Change the server name with your DNS server name and You should run this command from where the input file (list.txt) there, and this command will check all the DNS names in the input file (list.txt)

No need to change the input file format, yes we can use same input file for all this commands, you can use our Free DNS tool to create a single DNS record

Leave a Reply

Your email address will not be published. Required fields are marked *