Techibee.com

PowerShell: How to get DNS client Cache

Tip: How to get(or read) DNS client cache using PowerShell.

You know that DNS client caches the results it received from DNS server for the amount of allowed as per the values in DNS Zone. Client refers to this cache first before making a call to DNS server for resolving any record. Sometime this cache goes stale and we need to clear it to get fresh results. If you want to see what is there in local DNS client cache you can run IPCONFIG /displayDNS. This gives the details in plain text.

You can use below PowerShell cmdlet which is part of DNSClient in Windows 8 & Windows server 2012 and above operating systems to read what is there in the cache and the result is in object format which is easy to parse.

Get-DNSClientCache

You can look for cache details of a particular domain by passing it to -Entry parameter.

Get-DnsClientCache -Entry techibee.com

Use Get-Help cmdlet to know more about it.

Get-Help Get-DnsClientCache -Detailed

Hope this helps..

Exit mobile version