0

I've been looking for answers and couldn't quite find anything that worked for me, hopefully there's someone who can help me out with this.

I need to get the number of entries in the DNS cache of the computer. Not really even interested in the particular entries, just the total count.

This answer (Is there a way to monitor the system's DNS cache on c#?) comes close but I can't manage to download the powershell module to try to get it to work, plus it would be best if I could get a solution that worked without requiring any extra tools to be installed.

Thanks in advance.

Iván
  • 21
  • 3
  • Powershell is part of Windows. You don't have to download it. The link in the post you linked contains a link to TechNet that gives a 404, but has a list of possible related pages, and the very first one in the list is the one you want. That same answer has a link to sample code for using Powershell from C#. What more do you need? – Ken White Jan 14 '18 at 21:31
  • The dnsserver module containing Show-DnsServerCache is not in my computer (at least I can't access it, PowerShell says it's not there and so on). For what I have gathered it might be in the Windows Servers but for the others you have to download it – Iván Jan 14 '18 at 22:04

1 Answers1

1

I have managed to do it by using the PowerShell Get-DnsClientCache function.

DnsClient functions are apparently loaded by default in the non-server Windows OSs as well, unlike the dnsserver module.

Anyone interested can see an example on how to execute PowerShell scripts in the link posted in the original question.

Iván
  • 21
  • 3