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.
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>.dnszone files for file-based primary and secondary zones.cache.dns: the root hints (root servers) used by the server.- Files produced by
Export-DnsServerZoneordnscmd /ZoneExportwhen no path is given. - Possibly a
backupsubfolder and debug log files, depending on configuration.
Risks and best practices
- Deleting the
.dnsfile 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
DnsServerPowerShell module or the DNS console, not by editing the files.
Useful commands
# 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"