Do you see the “DNS server not authoritative for zone” error in the Windows Command Prompt or PowerShell? Here is a simple way to fix it.
When running a script or local server, you might sometimes see the “DNS server not authoritative for zone” in the Command Prompt or PowerShell window. For example, if you are trying to run a python script that needs access to the local server or local network, Windows might display the DNS server not authoritative for zone error. When the error happens, Windows will stop the command or script execution completely. Though the error message is cryptic, it is pretty easy to understand and fix it.
To understand the error, you have first to know what “DNS Authoritative Zone” means. In simple terms, an Authoritative Zone is a local zone in your system which it references for its DNS data. Since your system is considered authoritative, the zone within it is termed the “Authoritative Zone.” When something happens to the authoritative zone or if there is no relevant entry or DNS data is corrupt, Windows might show the “DNS server not authoritative for zone” error. The error can also happen if the shell, script, or server is not configured correctly.
The good thing is, with a few simple tricks, you can fix the “DNS server not authoritative for zone” error. Here is how.
Fix ‘DNS server not authoritative for zone’ error
Follow the below steps one after the other to troubleshoot and solve the “DNS server not authoritative for zone” error.
- Flush DNS from Command Prompt
- Open Command Prompt with new shortcut
- Open PowerShell with new shortcut
- Run SFC /Scannow command
Flush DNS from Command Prompt
One of the first things to do when you have problems with DNS is flush the DNS cache. This is because DNS entries are cached in the system for faster retravel. If the cache is corrupted for whatever reason, it causes all kinds of problems, including the “DNS server not authoritative for zone” error. The good thing is, it is straightforward to flush the DNS cache in Windows. Here is how.
Launch the Command Prompt window. You can either use the “cmd” run command or search for it in the Start menu. Type “ipconfig /flushdns” in the command window and press the Enter key on your keyboard.
On executing the command, Windows will flush the DNS cache. You will also see the “Windows IP Configuration. Successfully flushed the DNS Resolver Cache” message. Once that is done, close the command window and restart the computer.
After restarting, you will no longer see the DNS authoritative zone error.
Open Command Prompt with new shortcut
If you are using a custom shortcut for Command Prompt or created a new one with custom flags, it might also be a reason for the DNS authoritative zone error. In that case, you either have to use the original shortcut or create a new one with no flags.
To use the original Command Prompt shortcut, open the File Explorer, go to the “%appdata%\Microsoft\Windows\Start Menu\Programs\” folder and open the “Windows System” folder. Here, double-click on the “Command Prompt” shortcut.
If you want to, you can create a custom shortcut from scratch. To do that, right-click on the desktop and select “New > Shortcut.” Next, type “%windir%\system32\cmd.exe” in the blank field and click “Next.”
Name the shortcut and press “Finish.”
From now on, launch the Command Prompt window with the newly created shortcut. Hopefully, you will no longer see the “DNS server not authoritative for zone” error.
Open PowerShell with new shortcut
If you are a PowerShell user, you must create a new shortcut to avoid the DNS authoritative zone error. Like with Command Prompt, PowerShell too will cause errors under certain circumstances when using custom or modified shortcuts.
To create a new PowerShell shortcut, right-click on the desktop and select the “New > Shortcut” option. Type “%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe” in the blank field and click “Next.”
Finally, name the shortcut anything you want and click “Finish.”
From now on, whenever you are running a script or command, use the newly created shortcut. It should solve the “DNS server not authoritative for zone” error.
Run SFC /Scannow command
Suppose the above three methods did not work, then it might be a problem with system files. If your system recently crashed or some program messed with system files, it can cause an error in DNS authoritative zone. In that case, running the SFC command will help.
First, open the elevated Command Prompt window. To do that, search for Command Prompt in the Start menu, right-click on it, and select the “Run as administrator” option. Next, execute the “SFC /scannow” command.
It will start the system scan process and tries to fixes the problems it finds. Depending on the system, the scan and fix process will take some time to finish. Please sit back and relax till it is finished.
Once done, close the cmd window and reboot the computer. After rebooting, you will no longer see the error while running the commands.
I hope that helps.
If you are stuck or need some help, comment below, and I will try to help as much as possible.