Use this when stale DNS answers are cached on a client.
DNS Client Cache
The DNS client cache stores recent name lookups, including negative answers, for their TTL. View it with ipconfig /displaydns or Get-DnsClientCache and clear it with ipconfig /flushdns.
1. Get-DnsClientCache | ? Entry -like '*<name>*'.
2. Stale entry → Clear-DnsClientCache / ipconfig /flushdns.
3. Negative caching after a failure.
4. TTL decides lifetime.
5. Retest.
answer cached for TTL → used for repeat queries
Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
Get-DnsClientCachePrimary Commands
Configuration and operational commands for this Topic.
Get-DnsClientCacheVerifyReturns the DNS client cache entries as PowerShell objects that you can filter.
Use when: You want to filter cached DNS entries, for example Get-DnsClientCache -Entry <name>.
Quick note: Clear-DnsClientCache does the same as ipconfig /flushdns.
Windows / Windows Server / PowerShell · state · verifiesipconfig /displaydnsReferenceShows the entries in the local DNS client cache, including negative (failed) answers.
Use when: A name resolves to an old address on one machine but not on others.
Quick note: The cache also contains hosts-file entries. Get-DnsClientCache shows the same data as objects.
Windows / Windows Server / PowerShell · state · verifiesipconfig /flushdnsReferenceClears the local DNS client cache so the next lookup goes to the DNS server.
Use when: After a DNS record change, when the client still uses the old answer.
Quick note: Only the Windows DNS client cache is cleared. Browsers and applications can keep their own cache.
Windows / Windows Server / PowerShell · stateVerification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Common mistakes Narrow the fault
- Testing a DNS change without flushing the cache.
- Forgetting browser caches (Chrome
chrome://net-internals/#dns).
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
- Failed lookups are cached as negative answers too.
- ipconfig /flushdns clears the cache.
- Each entry lives for its TTL.
Resolve-DnsName <name>— resolve via the Windows resolverGet-DnsClientServerAddress— DNS servers per interfaceGet-DnsClientCache— resolver cacheGet-DnsClientGlobalSetting— suffix search listClear-DnsClientCache— flush the cache
ReferenceWhy it matters1 section · depth on demand
How it works
The DNS client cache holds answers for their TTL (capped by MaxCacheTtl, default one day). Entries from the hosts file are loaded into the cache too and do not expire. Applications using the Windows resolver share this cache; some (browsers, Java) keep their own.
ReferenceImportant terms & boundaries2 sections · depth on demand
In depth
Reading the cache
PS C:\> Get-DnsClientCache -Entry app.corp.example.com
Entry RecordName Record Status Section TimeTo Data Data
Type Live Length
----- ---------- ------ ------ ------- ------ ------ ----
app.corp.example.com app.corp.example.com A Success Answer 212 4 10.20.0.15
PS C:\> Get-DnsClientCache | Where Status -ne Success
| Column | Meaning |
|---|---|
Status Success | Positive answer cached |
Status NotExist / NoRecords | Negative answer cached — the name will keep failing until it expires |
| TimeToLive | Seconds left; counts down from the record TTL (capped by MaxCacheTtl) |
| Section | Answer, or Additional for glue |
Negative caching is the usual "it still fails after the fix"
If a client looked up a name before the record existed, it caches the failure. After creating the record, run Clear-DnsClientCache on the client (or wait). Server-side caches on the resolver also need clearing: Clear-DnsServerCache on the Windows DNS server answering the client.
Hosts file entries
Entries from C:\Windows\System32\drivers\etc\hosts are preloaded into the cache with a very long TTL and survive a flush (they are reloaded). Resolve-DnsName name -NoHostsFile bypasses them; an unexpected answer that only appears with the hosts file points to a stale hosts entry — often added during a migration and forgotten.
Who uses the cache
| Resolver path | Uses Windows DNS client cache? |
|---|---|
| Applications calling the Windows resolver (most) | Yes |
Resolve-DnsName | Yes (-DnsOnly/-NoHostsFile alter sources) |
nslookup | No — sends queries itself, ignores cache and hosts file |
| Browsers with their own DNS (DoH) | No — own cache |
This explains why nslookup shows the new address while the application still connects to the old one.
Registry tuning
MaxCacheTtl and MaxNegativeCacheTtl under HKLM\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters cap cache lifetimes; lowering the negative cache is common on hosts that depend on dynamically registered names.
*The DNS client cache records above are illustrative examples, not captured from a lab or production system.*
Commands
Get-DnsClientCache
Clear-DnsClientCache # = ipconfig /flushdns
ipconfig /displaydns
Negative answers are cached too (default up to 15 minutes, MaxNegativeCacheTtl).
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in DNS Client → DNS Client Cache. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://learn.microsoft.com/en-us/windows-server/networking/dns/dns-client-settings · confidence 94%