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,
of course to find the hostname you can use the IP address instead,
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
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 188.8.131.52
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
Bonus: You can view the whole DNS cache table on your computer using the following PowerShell command.
Hope this was helpful!