How to remove specific AAAA records from DNS using Powershell?
<p>I would like to remove all public IPv6 addresses from our DNS server, e.g. 2000:a61:10e3:8f01:: or 2003:d8:8bd7:c000:: but leave all link-local or site-local addresses e.g. fd00:: untouched.</p>

<p>I figured how to get a list of all AAAA records:</p>

<pre><code>$DNSServer = "dns.domain.net"
$ZoneName = "domain.net"
$NodeDNS = $null
$NodeDNS = Get-DnsServerResourceRecord -ZoneName $ZoneName -ComputerName $DNSServer -RRType AAAA -ErrorAction SilentlyContinue
</code></pre>

<p>Now the question is how to filter all those "public" records before invoking the Remove-DNSServerResourceRecord command?</p>

<pre><code>Remove-DnsServerResourceRecord -ZoneName $ZoneName -ComputerName $DNSServer -InputObject $NodeDNS -Force
</code></pre>

<p>would remove all AAAA records.</p>