PowerShell command for NSLookup

Resolve-DnsName is the PowerShell version of NSLookup. PowerShell commands are very powerful and feature-rich compared to the classic cmdlet commands. This is also common to the PowerShell equivalent of NSLookup. I will not discuss the command in detail but I will show you the most useful commands to get you going. 

Simply to find all general IP records for a domain you can use, 

Resolve-DnsName www.domain.com

PowerShell command for NSLookup

of course to find the hostname you can use the IP address instead, 

Resolve-DnsName 8.8.8.8

PowerShell command for NSLookup

You can filter or extend query results using many parameters.

Let’s say you need to see all NS records for a particular domain for this we can use –Type parameter, 

Resolve-DnsName www.randika.info -Type NS

PowerShell command for NSLookup

Here are some common record types you can use with -Type. 

  • NS = Name Server Records
  • A = Host Record (IPv4)
  • AAAA = Host Record (IPv6)
  • MX = Mail Exchange Information
  • SOA = Authority Zone
  • CNAME = Conanical Name
  • PTR = Domain Name Pointer Information
  • TXT = Text String Information

In case you want to retrieve information from a particular DNS server you can use –Server parameter, 

Resolve-DnsName www.randika.info -Server 8.8.8.8


You can also test the resolution strictly using the DNS protocol or using your computer’s Local DNS cache. This is really useful when testing partial DNS availabilities, DNS cache troubleshooting etc. 

– To only use DNS protocol for the resolution, 

Resolve-DnsName www.randika.info –DnsOnly

– To only use the client’s DNS Cache for the resolution 

Resolve-DnsName www.randika.info -CacheOnly

PowerShell command for NSLookup

Bonus: You can view the whole DNS cache table on your computer using the following PowerShell command. 

Get-DnsClientCache

PowerShell command for NSLookup

Hope this was helpful!

Like this post? Please share to your friends:
Leave a Reply

;-) :| :x :twisted: :smile: :shock: :sad: :roll: :razz: :oops: :o :mrgreen: :lol: :idea: :grin: :evil: :cry: :cool: :arrow: :???: :?: :!: