I just finished the first DNS chapter in my Elements book, the first of my three-book series on Server 2008. I always love talking about DNS — it’s a fun topic — but this particular chapter was a joy to write because I mostly threw away the old chapter and wrote an all-new one. In the process, I got a chance to include a lot of coverage of command-line support, now that Microsoft’s gotten serious about letting us do more and more with the command line. It dawned on me, however, that people wanting to refer to my command-line coverage in the chapter might not want to have to look through 100 pages of text, and so I collected all of the CLI DNS commands that I used throughout the chapter into a sort of “DNS cheat sheet.”
It’ll be months before the book arrives, though, and so I thought I’d post this on my site in the hopes that it’ll be of use to someone.
Function |
DNSCMD option |
Example |
Comments |
Do any dnscmd command on a |
dnscmd servername command |
dnscmd main.bigfirm.com /zoneprint bigfirm.com |
|
Create a primary zone |
dnscmd /zoneadd |
dnscmd /zoneadd |
|
Create a secondary zone |
dnscmd /zoneadd |
dnscmd /zoneadd |
|
Host a zone on a server based on an existing (perhaps |
dnscmd /zoneadd |
dnscmd /zoneadd |
|
Delete a zone from a server |
dnscmd /zonedelete |
dnscmd /zonedelete |
(without the /f, dnscmd asks |
Show all of the zones on a DNS server |
dnscmd /enumzones |
dnscmd /enumzones |
|
Dump (almost) all of the records in a zone |
dnscmd /zoneprint |
dnscmd /zoneprint |
Doesn’t show glue records. |
Add an A record to a zone |
dnscmd /recordadd |
dnscmd /recordadd |
|
Add an NS record to a zone |
dnscmd /recordadd |
dnscmd /recordadd |
|
Delegate a new child domain, naming its first DNS |
dnscmd /recordadd |
dnscmd /recordadd |
This would create the “test.bigfirm.com” DNS child |
Add an MX record to a zone |
dnscmd /recordadd |
dnscmd /recordadd |
|
Add a PTR record to a reverse lookup zone |
dnscmd /recordadd |
dnscmd /recordadd |
This is the PTR record for a system with IP address |
Modify a zone’s SOA record |
dnscmd /recordadd |
dnscmd /recordadd |
Ignores the serial number if it’s not greater than the |
Delete a resource record |
dnscmd /recorddelete |
dnscmd /recorddelete |
Again, “/f” means “don’t annoy me with a confirmation |
Create a resource record and incorporate a nonstandard |
dnscmd /recordadd |
dnscmd /recordadd |
|
Reload a zone from its zone file in \windows\system32\dns |
dnscmd /zonereload |
dnscmd /zonereload |
Really only useful on primary DNS servers |
Force DNS server to flush DNS data to zone file |
dnscmd /zonewriteback |
dnscmd /zonewriteback |
|
Tell a primary whom to allow zone transfers to |
dnscmd /zoneresetsecondaries |
dnscmd /zoneresetsecondaries |
That example says to allow anyone who asks to get a |
Enable/disable DNS NOTIFY |
dnscmd /zoneresetsecondaries |
dnscmd /zoneresetsecondaries |
Example disables DNS notification, which is contrary to |
Tell a secondary DNS server to request any updates from |
dnscmd /zonerefresh |
dnscmd /zonerefresh |
|
Enable or disable dynamic DNS on a zone |
dnscmd /config |
1 enables, 0 disables, 0 is default |
|
Stop the DNS service |
Either net stop dns or sc |
(No dnscmd command for this) |
|
Start the DNS service |
Either net start dns or sc |
(No dnscmd command for this) |
|
Install the DNS service on a 2008 full install system |
servermanagercmd -install dns |
||
Install the DNS service on a 2008 Server Core system |
ocsetup DNS-Server-Core-Role |
Case matters — ocsetup dns-server-core-role would fail |
|
Uninstall the DNS service on a 2008 Server full install |
servermanagercmd -remove dns |
||
Uninstall the DNS service on a 2008 Server Core system |
ocsetup /uninstall |
http://www.minasi.com/newsletters/nws0803a.htm