Fix: Could Not Flush the DNS Resolver Cache (Function Failed During Execution)

Martin Brinkmann
Updated •
Windows

"Could not flush the DNS Resolver Cache: Function failed during execution" usually means the DNS Client service is not running, or the command prompt is not elevated. Open services.msc, make sure DNS Client is running, open Command Prompt as administrator and run ipconfig /flushdns again. If it still fails, restart the PC or use the PowerShell command Clear-DnsClientCache. The same checks apply when a tool reports "Could not clear DNS cache. GetExitCodeProcess failed with error 1".

What the error means

The error means that Windows could not clear its local DNS cache because the service that holds it is not available. The DNS Client service resolves and stores DNS (domain name system) information to speed up repeat lookups, and Windows caches DNS requests for most programs that connect to the Internet by default.

A cache can contain outdated entries, which leads to loading problems when you connect to sites or servers. The ipconfig /flushdns command flushes the DNS cache so that Windows asks the configured DNS server again. Microsoft documents /flushdns as clearing and resetting the DNS client resolver cache.

The most likely cause of the error is that the DNS Client service is disabled or stopped. If Windows does not cache DNS requests at all, there is nothing to flush.

How to fix it: start the DNS Client service

Starting the DNS Client service fixes the error in most cases. Follow these steps:

  1. Press Windows-R to open the Run box.
  2. Type services.msc and press Enter.
  3. Locate the DNS Client service, right-click it and select Properties (or double-click it).

dns client service properties in the Windows Services console

Set the startup type to Manual or Automatic first, because the Start option only becomes available after that. Then select Start. If the service is already running, or the Start button is greyed out, restart the PC and run the command again.

Afterwards, ipconfig /flushdns should work as expected. You can then run ipconfig /displaydns to list the entries Windows stored in the cache, or read our guide to displaying all cached DNS entries on Windows.

Other checks: elevation, PowerShell and tools that report the error

Run Command Prompt or PowerShell as administrator if the command reports that it requires elevation: right-click the app, choose Run as administrator and accept the UAC prompt, then repeat ipconfig /flushdns.

In PowerShell, Clear-DnsClientCache does the same job. Microsoft states it is equivalent to ipconfig /flushdns, and Get-DnsClientCache shows what is cached first.

Some network tools run the flush command for you and show their own version of the error, for example "could not clear DNS cache, GetExitCodeProcess failed with error 1". Run ipconfig /flushdns yourself in an administrator prompt: if it fails with the message above, fix the DNS Client service first, then retry the tool.

If lookups still fail after a successful flush, the problem is the DNS server rather than the cache. Switching to a secure resolver can help, see how to enable DNS over HTTPS in your browser.

Related: Flush the DNS cache in Windows, Display cached DNS entries

Comments

  1. Just Looking said on
    Reply

    Since my host file is very large I’ve had this service disabled for the last two years. However, twice in that time I’ve had to use the network Repair command. Repair will fail unless the service is running.
    The solution is to manually start the service, do a repair, stop the service.

  2. Transcontinental said on
    Reply

    One thing is sure: the DNS Client service is often stated as indispensable, when in fact it is not at all, and is even advised to be off when using the HOSTS file. Moreover, no DNS Client service should means indeed no DNS cache issue.
    Martin states, “I’m not sure if it makes that much sense to flush the cache if the DNS Client is disabled as it should mean that Windows is not resolving and storing DNS at all”. Indeed, that’s the way I figure the scenario as well, but if Martin puts this matter on the ground, I guess it means the scenario may not be obvious.
    I’m interested as well in the issues regarding the DNS Client service

Leave a Reply

By commenting, you accept our privacy policy and keep the discussion respectful and on topic.