≡ Menu

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
Get-DNSClientCache

Use Get-Help cmdlet to know more about it.

Get-Help Get-DnsClientCache -Detailed

Hope this helps..

Comments on this entry are closed.

  • Anwar Mahmood October 1, 2015, 10:29 pm

    The Guest account does not have permissions to use get-DNSClientCache

    • TechiBee October 3, 2015, 4:35 pm

      You mean the built-in Guest account? What is the reason for using it? AFAIK, it is disabled by default and most audit controls recommend it to be disabled as well.

  • rob jaudon March 7, 2018, 11:49 pm

    Sweet…Learned a new command today!!

    Thank you.