SID-500

Home » PowerShell » The new nslookup: Resolve-DnsName

The new nslookup: Resolve-DnsName

Nslookup is a command-line tool for dns name resolution. Resolve-DnsName is the modern version of nslookup. In this blog post i will show how to use Resolve-DnsName to query DNS Host Names and much more.

Standard Query

To do a Standard Query simply run the command and specify the host name. Format-Table is not necessary, but helpful.

Resolve-DnsName sid-500.com | Format-Table -AutoSize

1.PNG

Query without Host File

Remember: Your host will first query the host file and the DNS Client Cache. If and only if the host file and the cache returns no result, the DNS Server is contacted. To avoid this, run Resolve-DnsName with the -NoHostFile Parameter.

Resolve-DnsName sid-500.com -NoHostsFile

Query in Cache-Only Mode

To demontrate this, i clear the Dns Client Cache and then i try to query sid-500.com. This must lead to an error. Bingo!

Clear-DnsClientCache
Resolve-DnsName sid-500.com -CacheOnly

8.png

Specify a DNS-Server

Resolve-DnsName without any parameter will contact your primary DNS-Server, which is configured in the settings of your network card. The parameter -Server allows you to specify other DNS-Servers.

Resolve-DnsName sid-500.com -Server 8.8.8.8 | Format-List

Unbenannt.PNG

Query for Records

Use the Type Parameter to query for specific records.

MX Records (Mail-Server)

Resolve-DnsName cnn.com -Type MX

Unbenannt.PNG

AAAA Records (IPv6 only)

Resolve-DnsName facebook.com -Type AAAA | Format-List

Unbenannt.PNG

Wait a minute. Did you notice it? No? Read the IPv6 Address of facebook again. 😉 They have left nothing to chance.

LLMNR Only

To use only Link Local Multicast Name Resoultion use the LlmnrOnly Parameter. LLMNR will only work with computers which share the same local link.

Dc01 and my computer share the same link. It works.

Resolve-DnsName dc01 -LlmnrOnly | Format-Table -AutoSize

Unbenannt.PNG

Sid-500.com is not on the same link. Which leads to an error.

Unbenannt.PNG

Link: https://technet.microsoft.com/de-de/library/jj590781%28v=wps.630%29.aspx?f=255&MSPPError=-2147217396

Related Links

For checking network and domain connectivity see my articles The modern version of ping: Test-Connection and Checking connectivity to Active Directory: Test-ComputerSecureChannel.


2 Comments

  1. […] checking name resoultion and network connectivity see also: The new nslookup: Resolve-DnsName and The modern version of ping: […]

    Like

  2. […] The new nslookup: Resolve-DnsName […]

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

Who is the blogger?

My name is Patrick Grünauer (pewa2303). I am from Austria. On sid-500 I write about Windows, Cisco and IT-Security in English and German. Have fun while reading!

Patrick Gruenauer
Follow SID-500 on WordPress.com