DNSCMD

Manage DNS servers, unattended setup and configuration of new DNS servers.

Syntax
      DnsCmd  ServerName Command [Command Parameters]
 
    ServerName:
       IP address or host name    -- remote or local DNS server
       .                          -- DNS server on local machine

    Command:
    /ageallrecords    Set the current time on all time stamps in a zone or node.
    /clearcache       Clear the DNS server cache.
    /config           Reset the DNS server or zone configuration.
    /createbuiltindirectorypartitions    Create the built-in DNS application directory partitions.
    /createdirectorypartition    Create a DNS application directory partition.
    /deletedirectorypartition    Delete a DNS application directory partition.
    /directorypartitioninfo      List information about a DNS application directory partition.
    /enlistdirectorypartition    Add a DNS server to the replication set of a DNS application directory partition.
    /enumdirectorypartitions    List the DNS application directory partitions for a server.
    /enumrecords     List the resource records in a zone.
    /enumzones       List the zones hosted by the specified server.
    /exportsettings  Write server configuration information to a text file.
                     %systemroot%\system32\dns\DnsSettings.txt
    /info            Get server information.
    /ipvalidate      Validate remote DNS servers.
    /nodedelete      Delete all records for a node in a zone.
    /recordadd       Add a resource record to a zone.
    /recorddelete    Remove a resource record from a zone.
    /resetforwarders       Set DNS servers to forward recursive queries.
    /resetlistenaddresses  Set server IP addresses to serve DNS requests.
    /startscavenging    Initiate server scavenging.
    /statistics      Query or clear server statistics data.
    /unenlistdirectorypartition    Remove a DNS server from the replication set of a DNS application directory partition.
    /writebackfiles    Save all zone or root-hint data to a file.
    /zoneadd           Create a new zone on the DNS server.
    /zonechangedirectorypartition    Change the directory partition on which a zone resides.
    /zonedelete        Deletes a zone from the DNS server.
    /zoneexport        Write the resource records of a zone to a text file,
                       located in %systemroot%\system32\dns
    /zoneinfo       Display zone information.
    /zonepause      Pause a zone.
    /zoneprint      Display all records in the zone.
    /zonerefresh    Force a refresh of the secondary zone from the master zone.
    /zonereload     Reload a zone from its database.
    /zoneresetmasters    Change the master servers that provide zone transfer information to a secondary zone.
    /zoneresetscavengeservers Change the servers that can scavenge a zone.
    /zoneresetsecondaries     Reset secondary information for a zone.
    /zoneresettype     Change the zone type.
    /zoneresume        Resume a zone.
    /zoneupdatefromds  Update an active directory integrated zone with data from active directory Domain Services (AD DS).
    /zonewriteback     Save zone data to a file.

Detailed Usage:

 DnsCmd ServerName /AgeAllRecords ZoneName [NodeName] [/Tree] [/f]
    Zone     -- ZoneName
    ZoneName -- FQDN of a zone
    NodeName -- name or node or subtree in which to enable aging
                   - "@" for zone root OR
                   - FQDN of a node (name with a '.' at the end) OR
                   - single label for name relative to zone root
    /Tree      -- force aging on entire subtree of node
                    or entire zone if node not given
    /f         -- execute without asking for confirmation

 DnsCmd ServerName /clearcache

 DnsCmd ServerName /Config ZoneName Property Value
   run DnsCmd /Config /? for more

 DnsCmd ServerName /CreateBuiltinDirectoryPartitions Option
   run DnsCmd /CreateBuiltinDirectoryPartitions /? for more

 DnsCmd ServerName /CreateDirectoryPartition FQDN of partition

 DnsCmd ServerName /DeleteDirectoryPartition FQDN of partition

 DnsCmd ServerName /DirectoryPartitionInfo FQDN of partition

 DnsCmd ServerName /EnlistDirectoryPartition FQDN of partition

 DnsCmd ServerName /EnumDirectoryPartitions [/Custom]

 DnsCmd ServerName /EnumRecords ZoneName NodeName [DataOptions] [ViewOptions]
   run DnsCmd /EnumRecords /? for more

 DnsCmd ServerName /EnumZones [Filter1 Filter2 ...]
   run DnsCmd /EnumZones /? for more

 DnsCmd ServerName /exportsettings

 DnsCmd Server /Info [Property]
   run DnsCmd /Info /? for more

 DnsCmd ServerName /IpValidate Context [ZoneName] [IPAddress] ..]
  Tests remote DNS server IP addresses
  Context can be one of:
    /DnsServers-- test that IPs are DNS servers
    /Forwarders -- test IPs to use as forwarders
    /RootHints -- test IPs to use as root hints
    /ZoneMasters -- test IPs to use as master servers for the zone named ZoneName

 DnsCmd ServerName /NodeDelete Zone NodeName [/Tree] [/f]
   run DnsCmd /NodeDelete /? for more

 DnsCmd ServerName /RecordAdd Zone NodeName [/Aging] [/OpenAcl] [/CreatePTR] [Ttl] RRType RRData
   run DnsCmd /RecordAdd /? for more

 DnsCmd ServerName /RecordDelete Zone NodeName RRType RRData [/f]
   run DnsCmd /RecordDelete /? for more

 DnsCmd ServerName /ResetForwarders [IPAddress] ...] [ /[No]Slave ] [/TimeOut Time]
   run DnsCmd /ResetForwarders /? for more

 DnsCmd ServerName /ResetListenAddresses [ListenAddress] ...]
  ListenAddress  -- an IP address belonging to the DNS server
    Default:  listen to all server IP Address(es) for DNS requests

 DnsCmd ServerName /startscavenging

 DnsCmd ServerName /Statistics [StatId | /Clear]
   run DnsCmd /RecordDelete /? for a list of StatIds

 DnsCmd ServerName /UnenlistDirectoryPartition FQDN of partition

 DnsCmd ServerName /WriteBackFiles [ZoneName]
  ZoneName -- FQDN of a zone whose datafile to be written back
    Default: write back datafile for all dirty zones

 DnsCmd ServerName /ZoneAdd ZoneName ZoneType [Options]
  ZoneName -- FQDN of zone
   run DnsCmd /ZoneAdd /? for more

 DnsCmd ServerName /ZoneChangeDirectoryPartition ZoneName NewPartition
    ZoneName      -- FQDN of zone to move to new partition
    NewPartition  -- FQDN of new directory partition or one of:
                         /domain   - domain directory partition
                         /forest   - forest directory partition
                         /legacy   - legacy directory partition

 DnsCmd ServerName /ZoneDelete ZoneName [/DsDel] [/f]
   /DsDel   -- Delete Zone from DS
   /f       -- Execute without asking for confirmation
   Default: delete zone from DNS sever, but NOT from DS

 DnsCmd ServerName /ZoneExport ZoneName ZoneExportFile (%systemroot%\system32\dns\)
    ZoneName    -- FQDN of zone to export
    /Cache      -- export cache

 DnsCmd Server /ZoneInfo ZoneName [Property]
  Property -- zone property to view
  Examples:
    AllowUpdate
    DsIntegrated
    Aging
    RefreshInterval
    NoRefreshInterval

 DnsCmd ServerName /ZonePause ZoneName

 DnsCmd ServerName /ZonePrint [ZoneName] [/Detail]
  ZoneName -- name of the zone (use ..Cache for DNS server cache)
  /Detail -- explicit RPC node contents

 DnsCmd ServerName /ZoneResetType ZoneName Property [Options]
  ZoneName      -- FQDN of zone
   run DnsCmd /ZoneResetType /? for more

 DnsCmd ServerName /ZoneRefresh ZoneName

 DnsCmd ServerName /ZoneReload ZoneName

 DnsCmd ServerName /ZoneResetMasters ZoneName [/Local] [Server IPs]
    /Local -- Set the local master list for DS integrated zones.
    Server IPs -- List of one or more IP addresses of master servers for
           this zone.  Masters may include the primary or other secondaries
           for the zone, but should not make the replication graph cyclic.

 DnsCmd ServerName /ZoneResetScavengeServers ZoneName [Server IPs]
    Server IPs -- list of one or more IP addresses of servers to scavenge
           this zone;  if no addresses given ALL servers hosting this zone
           will be allowed to scavenge the zone.

 DnsCmd ServerName /ZoneResetSecondaries ZoneName 
               [Security] [SecondaryIPAddress] ...]
               [Notify] [NotifyIPAddress] ...]
   run DnsCmd /ZoneResetSecondaries /? for more

 DnsCmd ServerName /ZoneResume ZoneName

 DnsCmd ServerName /ZoneUpdateFromDs ZoneName

 DnsCmd ServerName /ZoneWriteBack ZoneName

DNSCMD may be removed in a future version of Windows, Microsoft recommend moving over to the DNS cmdlets in PowerShell (Get-command -module DnsServer).

Commonly used record types

A (Host address)
AAAA (IPv6 host address)
ALIAS (Auto resolved alias)
CNAME (Canonical name for an alias)
MX (Mail eXchange)
NS (Name Server)
PTR (Pointer)
SOA (Start Of Authority)
SRV (location of service)
TXT (Descriptive text)

Examples

Backup Zone1.com in an Active Directory-integrated zone:

dnscmd DC1 /zoneexport Zone1.com backup\zone1.com.dns.bak

This will create a file in %systemroot%\system32\dns\backup

“Confidence comes not from always being right but from not fearing to be wrong” ~ Peter T. Mcintyre

Related commands

NETSH - Configure Network Interfaces.


 
Copyright © 1999-2024 SS64.com
Some rights reserved