Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Fellow Directory Services MVP Mark Minasi has a great table that shows a ton DNS commands using dnscmd. For those of you getting ready to use Server Core here is yet another list of commands that will come in handy. All I can say is WOW!!!
Function Do any dnscmd command on a remote system Create a primary zone Create a secondary zone Host a zone on a server based on an existing (perhaps restored) zone file Delete a zone from a server Show all of the zones on a DNS server Dump (almost) all of the records in a zone Add an A record to a zone Add an NS record to a zone Delegate a new child domain, naming its first DNS server Add an MX record to a zone Add a PTR record to a reverse lookup zone DNSCMD option dnscmd servername command dnscmd /zoneadd zonename /primary dnscmd /zoneadd zonename /secondary master IP address dnscmd /zoneadd zonename /primary /file filename /load dnscmd /zonedelete zonename [/f] dnscmd /enumzones dnscmd /zoneprint zonename dnscmd /recordadd zonename hostname A ipaddress dnscmd /recordadd zonename @ NS servername dnscmd /recordadd zonename childname NS dnsservername dnscmd /recordadd zonename @ MX priority servername dnscmd /recordadd zonename lowIP PTR FQDN dnscmd /recordadd zonename @ SOA primaryDNSservername responsibleemailipaddress serialnumber refreshinterval retryinterval expireinterval defaultTTL dnscmd /recorddelete zonename recordinfo [/f] dnscmd /recordadd zonename leftmostpartofrecord TTL restofrecord dnscmd /zonereload zonename dnscmd /zonewriteback zonename dnscmd /zoneresetsecondaries zonename /nonsecure|securens dnscmd /zoneresetsecondaries zonename /notify|/nonotify Example dnscmd main.bigfirm.com /zoneprint bigfirm.com dnscmd /zoneadd bigfirm.com /primary dnscmd /zoneadd bigfirm.com /secondary 192.168.1.1 dnscmd /zoneadd bigfirm.com /primary /file bigfirm.com.dns /load dnscmd /zonedelete bigfirm.com /f dnscmd /enumzones dnscmd /zoneprint bigfirm.com dnscmd /recordadd bigfirm.com mypc A 192.168.1.33 dnscmd /recordadd bigfirm.com @ dns3.bigfirm.com dnscmd /recordadd bigfirm.com test NS main.bigfirm.com dnscmd /recordadd bigfirm.com @ MX 10 mail.bigfirm.com dnscmd /recordadd 1.168.192.inaddr.arpa 3 PTR pc1.bigfirm.com dnscmd /recordadd bigfirm.com @ SOA winserver.bigfirm.com mark.bigfirm.com 41 1800 60 2592000 7200 dnscmd /recorddelete bigfirm.com @ NS main.bigfirm.com /f dnscmd /recordadd bigfirm.com pc34 3200 A 192.168.1.4 dnscmd /zonereload bigfirm.com dnscmd /zonewriteback bigfirm.com dnscmd /zoneresetsecondaries bigfirm.com /nonsecure dnscmd /zoneresetsecondaries bigfirm.com /nonotify That example says to allow anyone who asks to get a zone transfer Example disables DNS notification, which is contrary to the default settings. Really only useful on primary DNS servers This is the PTR record for a system with IP address 192.168.1.3 Ignores the serial number if it's not greater than the current serial number Again, "/f" means "don't annoy me with a confirmation request, just do it." This would create the "test.bigfirm.com" DNS child domain unter the bigfirm.com DNS domain Doesn't show glue records. Comments
(without the /f, dnscmd asks you if you really want to delete the zone)
Delete a resource record Create a resource record and incorporate a nonstandard TTL Reload a zone from its zone file in \windows\system32\dns Force DNS server to flush DNS data to zone file Tell a primary whom to allow zone transfers to
Tell a secondary DNS server to request any updates from the primary Enable or disable dynamic DNS on a zone Stop the DNS service Start the DNS service Install the DNS service on a 2008 full install system Install the DNS service on a 2008 Server Core system Uninstall the DNS service on a 2008 Server full install system Uninstall the DNS service on a 2008 Server Core system
dnscmd /zonerefresh zonename dnscmd /config zonename /allowupdate 1|0 Either net stop dns or sc stop dns Either net start dns or sc start dns servermanagercmd -install dns ocsetup DNS-Server-Core-Role
dnscmd /zonerefresh bigfirm.com 1 enables, 0 disables, 0 is default (No dnscmd command for this) (No dnscmd command for this)
Function Do any dnscmd command on a remote system Create a primary zone Create a secondary zone
dnscmd /zoneadd zonename /primary dnscmd /zoneadd zonename /secondary master IP address dnscmd /zoneadd zonename /primary /file filename /load
Host a zone on a server based on an existing (perhaps restored) zone file Delete a zone from a server
Example dnscmd main.bigfirm.com /zoneprint bigfirm.com dnscmd /zoneadd bigfirm.com /primary dnscmd /zoneadd bigfirm.com /secondary 192.168.1.1 dnscmd /zoneadd bigfirm.com /primary /file bigfirm.com.dns /load dnscmd /zonedelete bigfirm.com /f
Comments
(without the /f, dnscmd asks you if you really want to delete the zone) Doesnt show glue records.
Show all of the zones on a DNS server Dump (almost) all of the records in a zone Add an A record to a
zone Add an NS record to a zone Delegate a new child domain, naming its first DNS server
zonename hostname A ipaddress dnscmd /recordadd zonename @ NS servername dnscmd /recordadd zonename childname NS dnsservername
bigfirm.com mypc A 192.168.1.33 dnscmd /recordadd bigfirm.com @ A dns3.bigfirm.com dnscmd /recordadd bigfirm.com test NS main.bigfirm.com
This would create the test.bigfirm.co m DNS child domain unter the bigfirm.com DNS domain
Add an MX record to dnscmd /recordadd a zone zonename @ MX priority servername Add a PTR record to dnscmd /recordadd a reverse lookup zonename lowIP PTR zone FQDN Modify a zones SOA record
dnscmd /recordadd bigfirm.com @ MX 10 mail.bigfirm.com dnscmd /recordadd 1.168.192.inaddr.arpa 3 A pc1.bigfirm.com dnscmd /recordadd bigfirm.com @ SOA winserver.bigfirm.c om mark.bigfirm.com 41 1800 60 2592000 7200
dnscmd /recordadd zonename @ SOA primaryDNSservernam e responsibleemailipaddr ess serialnumber refreshinterval retryinterval expireinterval defaultTTL dnscmd /recorddelete zonename recordinfo [/f]
This is the PTR record for a system with IP address 192.168.1.3 Ignores the serial number if its not greater than the current serial number
Create a resource record and incorporate a nonstandard TTL Reload a zone from its zone file in \windows\system32\ dns Force DNS server to flush DNS data to
dnscmd /recordadd bigfirm.com pc34 3200 A 192.168.1.4 dnscmd /zonereload bigfirm.com Really only useful on primary DNS servers
dnscmd /zonewriteback
That example says to allow anyone who asks to get a zone transfer Example disables DNS notification, which is contrary to the default settings.
Tell a secondary DNS server to request any updates from the primary Enable or disable dynamic DNS on a zone Stop the DNS service
Start the DNS service Install the DNS service on a 2008 full install system Install the DNS service on a 2008 Server Core system Uninstall the DNS service on a 2008 Server full install system Uninstall the DNS service on a 2008 Server Core system
dnscmd /config 1 enables, 0 zonename /allowupdate disables, 0 is default 1|0 Either net stop dns or sc (No dnscmd stop dns command for this) Either net start dns or (No dnscmd sc start dns command for this) servermanagercmd install dns ocsetup DNS-ServerCore-Role Case matters -ocsetup dnsserver-corerole would fail