You're managing a Windows DNS server—could be 2012 R2, 2016, or 2019—and you see this error in the DNS Manager or in the Event Log under DNS Events. The exact text reads: DNS_ERROR_INVALID_DATAFILE_NAME (0X000025B4). The zone won't load. You might've recently renamed a zone, moved a zone file, or restored a backup of the DNS folder. The common trigger: you manually changed the file name in C:\Windows\System32\dns but forgot to update the zone configuration in the registry or DNS console.
Root cause
The DNS server keeps a list of zones in the registry under HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\DNS Server\Zones. For each zone, there's a string value called DataFile that points to the exact .dns file name in the system32\dns folder. If that file doesn't exist, or if the name doesn't match what's in the registry, the server throws 0x000025B4. The server can't find the data file, so it refuses to load the zone.
Short version: the zone expects a specific .dns file, but that file is missing or has a different name.
What you need
- Admin access to the DNS server
- Permissions to read the registry (you need this to check the expected file name)
- Access to
C:\Windows\System32\dns
Step-by-step fix
Step 1: Identify the zone and the expected file name
- Open DNS Manager (run
dnsmgmt.msc). Look at the zone that's showing the error. Write down the zone name (example:example.local). - Open Registry Editor (run
regedit). - Go to:
HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\DNS Server\Zones - Find the subkey with the same name as your zone. Under that key, look for a value called
DataFile. Double-click it and note the file name (example:example.local.dns). - Close Registry Editor.
After this step, you know exactly which file the server expects.
Step 2: Check the actual file in the dns folder
- Open File Explorer and go to:
C:\Windows\System32\dns - Look for a file matching the name from Step 1. If you see it, skip to Step 4. If you don't see it, or you see a file with a different name (like
example.local.old.dns), move to Step 3. - If the folder is empty or the file is missing entirely, you need to restore it from backup or recreate it. I'll cover that below.
Step 3: Fix the mismatch
Here's the real fix. You have two paths—choose the one that fits your situation.
Option A: Rename the existing .dns file to match the registry
- In
C:\Windows\System32\dns, right-click the actual .dns file (the one that's there but has the wrong name). - Choose Rename and change it to exactly what the registry expects (from Step 1).
- Press Enter. Accept the UAC prompt if needed.
Option B: Update the registry to match the existing file name
- In
C:\Windows\System32\dns, note the exact name of the .dns file that's present (example:example.local.2025.dns). - Open Registry Editor again, go to
HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\DNS Server\Zones\yourzone. - Double-click
DataFile, change the value to the name you noted (including the extension.dns), and click OK. - Close Registry Editor.
My opinion: Option A is usually simpler and less risky, because you're not poking at the registry unless you have to. But if the file name is something you want to keep (like a date-stamped backup), go with Option B.
Step 4: Restart the DNS service and reload the zone
- Open a Command Prompt as administrator or use PowerShell.
- Run:
net stop dns && net start dns - Wait a few seconds, then open DNS Manager.
- Right-click the problematic zone and select Reload.
- Check the zone now—it should load without the error.
If it still fails
If the error persists, here's what to check next:
- File permissions: Right-click the .dns file in
C:\Windows\System32\dns, go to Properties > Security. Make sureSYSTEMandNETWORK SERVICEhave Read & Execute and Read permissions. If not, add them. - Corrupt file: The .dns file might be corrupt (zero bytes or garbage). Open it in Notepad—it should start with something like
; Database file example.local.dns for example.local zone.If it's empty or binary, restore from a known good backup. - Zone type mismatch: Check if the zone is a primary zone. Secondary zones don't use local .dns files—they get data from a master server. If the zone is secondary, the
DataFileregistry entry might be wrong. In that case, delete the zone and recreate it as secondary. - Check Event Log: Look in Event Viewer > Applications and Services Logs > DNS Server. There's usually a more detailed error entry that says exactly which file it can't find.
A quick sanity check: make sure you're not accidentally looking in the wrong folder. Some admins copy files to
system32\dnsbut the server expects them insystem32\dns\backuporsystem32\dns\samples. The correct folder isC:\Windows\System32\dns(no subfolder).
If you've done all this and it's still broken, your DNS database might be damaged at a deeper level. Restore the system32\dns folder from a known good backup (ideally from before the rename or move), then restart the service.