Microsoft Windows 10 Flush DNS Cache

Microsoft Windows Random

It used to be easy to flush the cache, but recent changes to the DNS Client on Microsoft Windows 10 (and 11) have made this more difficult, you used to be able to run an “ipconfig /flushdns” or failing that restart the “DNS Client” service, but these don’t appear to work any longer.

However you can still flush the DNS cache on a client machine quickly. Just create a batch file called “FlushDNS.bat” and then including the following:

PowerShell.exe -WindowStyle Hidden -NoProfile -NoLogo -Command "try { $ServicePID = (get-wmiobject win32_service | where { $_.name -eq 'Dnscache'}).processID; Stop-Process $ServicePID -Force } catch {}"

Save the file, then double click to run it, you should find that the DNS cache on your machine has been cleared.

If you find it is doing nothing you may need to right click and “Run as Administrator” to ensure the Powershell script runs with sufficient privileges.

Leave a Reply

Your email address will not be published. Required fields are marked *