Adding DNS entries with command line on Windows
Hello,
If you are lazy (as we are) or you don’t want to waste all your time adding DNS entries manually, you can use dnscmd via command line on Windows. It’s a nice way to put a large entries from a file or something that needs further configuration.
PROMPT> dnscmd help
dnscmd yourdnsserver /RecordAdd yourdomain.com mynewrecord A ip
so
(creates ftp.domain.com that points to 192.168.1.20)
dnscmd localhost /RecordAdd domain.com ftp A 192.168.1.20
(creates www.domain.com that points to 192.168.1.21)
dnscmd localhost /RecordAdd domain.com www A 192.168.1.21
You can use A, CNAME, PTR, TXT etc.
An example of a batch file putting entries in the same IP using loops.
PROMPT> type records.txt
record1
record2
record2
etc …
type dns.bat
@echo off
set dnshost=localhost
set domain=yourdomain.com
set type=A (dns type, PTR, CNAME etc)
set ipserver=192.168.1.20
echo “We are reading line by line records.txt”
for /f %%record in (records.txt) do dnscmd %dnshost% /RecordAdd %domain% %%record %type% %ipserver%
See you!
on September 12, 2008 on 15:11
Hi All,
I need help on this. I need to ADD a SYSTEM DNS from a Command Prompt.
And the DNS uses a driver Microsoft Access Driver (*.MDB).
Please Need your help.
Sudhir
on September 12, 2008 on 15:19
I’m sorry but you are confusing concepts and acronyms. Here we were talking about DNS (Domain Name System, http://en.wikipedia.org/wiki/Domain_Name_System), you are seeking info on DSN (Database Source name, http://en.wikipedia.org/wiki/Database_Source_Name). I left the DSN’s realm years ago so I’m sorry but I cannot help you. :)