Back to Learning
Windows · PowerShellBeginner

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.

Interactive simWindowsPowerShellDNSTroubleshooting

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

PowerShell: Resolve-DnsName and Clear the Cache

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.

Locked

Sign up with your email to open PowerShell: Resolve-DnsName and Clear the Cache, free. You get the root cause and the full step-by-step fix.

No spam. The fix lands in your inbox too. Signing up includes 4 guided labs free, tracked against your email. After that, the Learning Pass unlocks every remaining lab.

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.

Read only the local cache
Resolve-DnsName api.lab.example -Type A -CacheOnly
Query the DNS server
Resolve-DnsName api.lab.example -Type A -Server 10.20.30.53

Topology 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.