How to Use the Windows 11 Resolve-DnsName PowerShell Command to Check Domain Records

For decades, network administrators have relied on the legacy nslookup command in the Windows Command Prompt to troubleshoot DNS issues. While functional, nslookup returns data as plain text, making it incredibly difficult to parse inside automated scripts. To modernize network diagnostics, Windows 11 includes a powerful PowerShell native cmdlet called Resolve-DnsName. This command performs the same function as nslookup but outputs the results as highly structured, scriptable objects.

Basic DNS Resolution

At its core, Resolve-DnsName translates a human-readable domain name (like google.com) into its corresponding numerical IP address.

  1. Click the Windows 11 Start Menu.
  2. Type PowerShell and press Enter.
  3. In the console window, type the command followed by the domain you wish to query:

Resolve-DnsName google.com

  1. Press Enter.

PowerShell will output a neatly formatted table displaying the domain name, the record type (A for IPv4, AAAA for IPv6), the Time to Live (TTL), and the resolved IP addresses. Because this is an object-oriented table, you can easily pipe this data into other PowerShell commands to filter or export the results.

Querying Specific Record Types

When verifying domain ownership or configuring email servers, you frequently need to check records other than standard IP addresses. You might need to verify a Mail Exchanger (MX) record or a Text (TXT) record. You can specify the exact record type you want to retrieve using the -Type parameter.

To view the mail servers responsible for handling email for a domain, run:

Resolve-DnsName microsoft.com -Type MX

To view the SPF (Sender Policy Framework) data hidden inside the domain’s text records, run:

Resolve-DnsName microsoft.com -Type TXT

This targeted querying allows you to instantly verify that your recent DNS changes have propagated across the internet.

Testing Against Specific DNS Servers

By default, Resolve-DnsName queries the DNS server currently configured in your Windows network adapter settings (usually your local router or ISP). If you are experiencing a local network cache issue, you might want to query a public, external DNS server directly to see if the global record has updated.

You can force the command to bypass your local network and query a specific server using the -Server parameter. For example, to ask Cloudflare’s public DNS server (1.1.1.1) to resolve a domain, use:

Resolve-DnsName example.com -Server 1.1.1.1

If Cloudflare returns the correct, updated IP address but your default command returns an old, broken address, you instantly know that your local network DNS cache is stale and needs to be flushed using ipconfig /flushdns.

Leave a Reply

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

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.