Resolve-DnsName

DNS lookups from PowerShell.

Windowspassive

Resolve-DnsName queries DNS for any record type, returning structured objects — the PowerShell equivalent of dig/nslookup.

Syntax

Resolve-DnsName {name} [-Type {type}]

Example

Resolve-DnsName example.com -Type MX

Returns the MX records for the domain as objects you can filter.

Options & flags

What each switch does. Toggle them in the builder below to assemble a command.

-Name <target.tld>Name to resolve.
-Type <MX>Record type (A, MX, TXT, ANY…).
-Server <8.8.8.8>Use a specific DNS server.
-DnsOnlySkip LLMNR/NetBIOS, DNS only.

Command builder

Tick options (and fill any values) to build a ready-to-copy command.

resolve-dnsname

Usage examples

Resolve-DnsName target.tld -Type MX

Get mail records.

Resolve-DnsName target.tld -Type TXT

Get TXT/SPF records.

Advantages
  • Structured object output
  • All record types
  • No external tools
Disadvantages
  • Windows-only
  • Less terse than dig
  • Honors local resolver cache
Tags
#windows#dns

Official docs: Resolve-DnsName

Related commands

Frequently asked questions

What is Resolve-DnsName used for?
Resolve-DnsName queries DNS for any record type, returning structured objects — the PowerShell equivalent of dig/nslookup.
What is an example Resolve-DnsName command?
A common example is: Resolve-DnsName example.com -Type MX — Returns the MX records for the domain as objects you can filter.
Is Resolve-DnsName part of a standard install?
Resolve-DnsName runs on Windows. It is typically available by default.
What category of security tool is Resolve-DnsName?
Resolve-DnsName is a PowerShell tool with a passive-risk profile when run against a live target.

Try recon tools live

Run real scans against a domain you control, stage by stage.

Open the lab →