If you see message The requested pause, continue, or stop is not valid for this service for DNSCache, Winmgmt, TrustedInstaller, then this post will interest you.
Net stop dnscache Not working
If you are unable to stop the DNS Cache service, then this is because of a change made in the Windows operating system now. DNS Client Service in Windows OS is used to resolve DNS. It first queries locally or connects to a remote DNS server if the query was not made before. Restarting the service was one of the ways to troubleshoot any DNS issue. However, if you are not able to do it anymore and have received The requested pause, continue, or stop is not valid for this service then this post reveals the reason.
The requested pause, continue, or stop is not valid for this service
When trying to perform any of such operations from the command line (net stop dnscache
) or by going to Services snap-in and opening DNS Client service, these options are disabled or not available.
Starting from Windows 10 21H1 and in Windows 11, all user-based operation is disabled for all user accounts, including for the Administrator account.
The full error message goes as:
The requested pause, continue, or stop is not valid for this service.
More help is available by typing NET HELPMSG 2191.
net helpmsg 2191
Options such as flushdns, displaydns work – but not this one. The annoying part is if there is a change and the client caching time is high, it will be difficult to access some of the websites.
What can you do if there is no option to Restart the DNS Client?
You can change it using the registry method using an administrator account. Make sure to take a backup of your registry before making any changes.
Open Run prompt, type regedit, and press the Enter key
This will open Registry Editor
Navigate to:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\DNSCache\Parameters
Right-click on an empty area, and create a new DWORD.
Set the Name as MaxCacheTtl and set the value in seconds. The default is 86400 seconds which is one day.
Repeat the same and create another DWORD with the name MaxNegativeCacheTtl and value as 5
This will make sure the local DNS cache is refreshed every few hours.
How to Clear Client DNS Cache?
Commands such as Clear-DnsClientCache
and ipconfig /flushdns
still, work, and you can execute them from the Command Prompt or PowerShell. Both will clear the local cache, and followed by a restart, if needed, should do the trick.
What is the DNS Resolver Cache?
To speed up resolving website name to IP address and hence loading the website, Windows maintains a local copy of website name to IP address in its local cache. When you have this, the browser doesn’t need to contact the DNS and can instead use this. As it is periodically refreshed, it works well.
How to view DNS Cache?
On a command prompt, execute the command ipconfig /displaydns
to view all the website and their resolved IP address. It will be available in the following format:
- Record Name
- Record Type
- Time To Live
- Data Length
- Section
- A (Host) Record
If you use PowerShell, you can use the Get-DnsClientCache
command. It offers better visualization compared to the long scroll of the Command Prompt.
I hope the post was easy to understand, and now you know why you had received the error when trying to restart the DNS Client in Services.