nslookup
Legacy DNS lookup tool. Available on every platform without installation. Interactive mode for rapid iteration.
Why nslookup Still Matters
dig is superior for DNS debugging. But nslookup is pre-installed on Windows, available in PowerShell sessions, and the tool most network engineers reach for first. Knowing it means you can troubleshoot from any machine without installing anything.
Basic Queries
nslookup example.com
Returns the server used for resolution and the answer. Unlike dig, nslookup shows both "Non-authoritative answer" and "Authoritative answer" labels.
nslookup inside.domusdigitalis.dev 10.50.1.50
Bypasses the system resolver. Directly tests whether the target server has the record.
nslookup 10.50.1.20
nslookup automatically detects IP input and performs a PTR query. No -x flag needed (unlike dig).
Record Type Queries
nslookup -type=MX example.com
nslookup -type=TXT example.com
nslookup -type=NS example.com
nslookup -type=SOA inside.domusdigitalis.dev
nslookup -type=SRV _ldap._tcp.dc._msdcs.inside.domusdigitalis.dev
The Windows domain join process uses exactly this query to find domain controllers.
nslookup -type=ANY example.com
Some servers refuse ANY queries (RFC 8482).
Interactive Mode
nslookup
> server 8.8.8.8
> set type=MX
> example.com
> set type=A
> example.com
> exit
Interactive mode is useful for rapid multi-query debugging without retyping the server each time.
nslookup
> set debug
> example.com
Shows the raw DNS message including header flags, question section, and all response sections. Closest nslookup gets to dig’s full output.
Windows PowerShell Equivalent
Resolve-DnsName -Name example.com -Type A
Resolve-DnsName -Name example.com -Type MX -Server 8.8.8.8
Resolve-DnsName -Name 10.50.1.20 -Type PTR
PowerShell’s Resolve-DnsName returns structured objects — pipe to Select-Object, Where-Object, and Format-Table. Strictly superior to nslookup for scripting on Windows.
nslookup vs dig — When to Use Which
-
nslookup: Available everywhere. Quick check from a Windows workstation or a minimal server with no dig installed. Interactive mode for rapid iteration.
-
dig: Precise control over output format (
+short,+noall +answer). DNSSEC inspection (+dnssec). Trace delegation (+trace). Scriptable with clean machine-parseable output. Always prefer dig when available.
See Also
-
dig — the superior tool when available
-
PowerShell Network — Resolve-DnsName and more