Author Posts

April 30, 2018 at 2:10 pm

I am working with a company that has a a number of parent and child domains in DNS. The layout is something like this:

I am attempting to write a script that will search through all of DNS for A records. When I attempt to list all forward lookup zones, like so:

Get-DnsServerZone -ComputerName dnsServer01 |
    Where-Object {$_.IsReverseLookupZone -eq $false} | 

I get only the top level zones (,, etc.). I cannot return, or This is leaving me unable to search for the A records in all areas.

As an alternative, I have tried searching for the records using the .Net method, like so:

$pc = "testPC1"

and this returns the HostName including Zone name, CNAME and IP address(es) as I would expect. But I am unsure how then to translate this into a method of modifying or deleting the record, as even a straight call to that zone is failing for me. For example, running the code above gives me the output of "", however if I run this:

Get-DnsServerResourceRecord -ComputerName $DNSServer -ZoneName "" -Node "testPC1"

I get the error:

Get-DnsServerResourceRecord : The zone was not found on server $DNSServer.

I tried going up a level to just, but get the response:

Get-DnsServerResourceRecord : Failed to get testPC1 record in zone on DNSServer server.

So I am looking for suggestions on either querying through all levels of dns zones, or somehow using the other DNS functions on the information returned from the .Net call that seems to be working.

May 1, 2018 at 12:16 am

Did you see Matt's response to your previous post?