Windows dns caching server: flush dns cache for single zone programatically

domain-name-systemwindows

in bind9 I can use rndc flushname zone.tld from a shell.

In the Windows DNS mmc I can select the zone and delete it.

With dnscmd I can flush the whole cache, but I just need to flush a zone's cache every now and then.

Is it possible and how? TIA

Best Answer

DNSCmd.exe is used to display and change the properties of DNS servers, zones, and resource records. You can find detailed syntax here. As much as I would like to give proper reference and explanation for this, I found it by random googling, trial and error: cached lookups seem to be internally stored in Zone called ..Cache, and each cached zone is only a node under "..Cache", so the right switch to use is /NodeDelete:

dnscmd dnsserver.local /NodeDelete ..Cache whatever.com [/Tree] [/f]

 /tree    Specifies to delete all of the child records.
 /f       Executes the command without asking for confirmation.

Still, it would be cool if anyone could find "..cache" in MS official documentation.