this is great! thank you! queries all zones on dns server.

Oct 1, 2013 at 11:07 PM
I have 1 question though. we have active directory dns with many zones. we create A records for the same servers in several zones. my need is to enter the IP address and retrieve all of the name records that match to that IP out of the forward lookup. I have tried using -filter with recorddata and with ipaddress but always get invalid query.

is it possible to accomplish what im trying to do. I feel its so close as this already goes through every zone for the name, I just need it to do the same for the ip. im afraid that our reverse looup zones are not anywhere near reliable.
Coordinator
Oct 2, 2013 at 7:55 PM
Edited Oct 2, 2013 at 7:58 PM
There are a few nice simple ways:

Get-ADDnsPartition | Get-ADDnsRecord | Where-Object { $_.IPAddress -match '1.2.3.4' }

Or:

Get-DnsRecord -RecordType A | Where-Object { $_.IPAddress -match '1.2.3.4' }

Or, using the Filter field (which passes straight through to a WMI query):

Get-DnsRecord -Filter 'RecordData="1.2.3.4"'

The first is generally faster, but both should work for this.

HTH

Chris
Oct 2, 2013 at 8:36 PM

Thanks so much for the reply! I was trying double quotes and double-double quotes for my –filter ie “RecordData = “1.1.1.1”” also tried no quotes. Never thought to use single quote. Worked like magic! Again, great,great code! Thanks for sharing!