Skip to contentGo to the directory tree
FolderRisk: Caution
  • Windows Server

dns C:\Windows\System32\dns

DNS Server role folder: zone files (.dns), root hints and exports for zones stored in files.

Updated on By AltF4 Formation

What it’s for

The DNS Server role creates System32\Dns. When a zone is stored in a file rather than in Active Directory, its primary zone file is named zone_name.dns by default and sits here. Active Directory-integrated zones do not keep their data here.

What it contains

  • <zone>.dns zone files for file-based primary and secondary zones.
  • cache.dns: the root hints (root servers) used by the server.
  • Files produced by Export-DnsServerZone or dnscmd /ZoneExport when no path is given.
  • Possibly a backup subfolder and debug log files, depending on configuration.

Risks and best practices

  • Deleting the .dns file of a live zone makes it empty or unavailable. Keep an off-server backup of file-based zones.
  • AD-integrated zones are replicated by the directory: for them, this folder holds at best an export.
  • To migrate zones, follow Microsoft’s procedure: copy the whole folder and export the related Registry keys.
  • Change zones with the DnsServer PowerShell module or the DNS console, not by editing the files.

Useful commands

Fenêtre de terminal
# Server zones and associated file (empty for an Active Directory-integrated zone)
Get-DnsServerZone | Select-Object ZoneName, ZoneType, IsDsIntegrated, ZoneFile
# Folder contents (read-only)
Get-ChildItem "$env:windir\System32\dns" -Force | Select-Object Name, Length, LastWriteTime
# Export a zone to the folder (as administrator; adjust zone)
Export-DnsServerZone -Name "contoso.com" -FileName "contoso.com.bak.dns"

Folder contents

Report a mistake