PowerShell: Resolve-DnsName and Clear the Cache
Compare cache-only and server-specific DNS answers, clear the client cache, and confirm the current A record. Work through it yourself in the live host terminal below.
Symptom
Compare cache-only and server-specific DNS answers, clear the client cache, and confirm the current A record.
Your mission
Inspect, recover, then verify
Format
Windows PowerShell
Investigate before you configure.
Use the CLI evidence to isolate the fault, make the smallest safe correction, then verify the network state changed.
Observe the symptom and link state.
Diagnose by comparing the protocol evidence.
Verify the expected device state and confirm the original symptom is resolved.
Console access: PowerShell
This workspace stacks for portrait phones. Rotate to landscape for the full split-screen console.
Need a hint?
Reveal the root cause when you're ready.
Try the investigation first, then use this as your escape hatch, not a dead end.
Lab debrief
Turn the session into a repeatable troubleshooting pattern.
Use this reference after your attempt: first explain the symptom, then verify the evidence, then confirm the repair.
The problem
A PowerShell script connects to the old API address even though the authoritative DNS server has the replacement address.
What you'll practice
- Query A records with Resolve-DnsName
- Use -CacheOnly to isolate local state
- Use -Server to query a named resolver
- Clear client cache with Clear-DnsClientCache
The topology
One Windows client caches an old API A record. DNS server 10.20.30.53 returns the current record.
Commands to run yourself
The real diagnostic commands for this lab, copy-paste ready. Run these in the same order to reproduce the investigation on your own session.
Resolve-DnsName api.lab.example -Type A -CacheOnlyResolve-DnsName api.lab.example -Type A -Server 10.20.30.53Topology diagram
Fact-checked references
The commands and behaviour in this lab were checked against these primary references.
Frequently asked
Why use -CacheOnly?
It deliberately avoids a wire query, so you can see what the client already believes.
Is Clear-DnsClientCache the same as ipconfig /flushdns?
Microsoft documents them as equivalent ways to clear the DNS client cache.
Ready to run this lab yourself?
No setup, no image sourcing. Book a session or ask for a live demo.