A Strange DNS Result

Copper Contributor

Trying to collect some DNS information for some maintenance work, I ran into this:

Get-DnsServerResourceRecord -computername myDC -ZoneName contoso.com -rrtype A 
HostName            RecordType Type       Timestamp            TimeToLive      RecordData                                        
--------            ---------- ----       ---------            ----------      ----------      
machine1            A          1          10/25/2009 6:00:0... 00:20:00                                    
machine2            A          1          5/9/2019 5:00:00 AM  00:20:00                                     
machine3            A          1          12/6/2019 7:00:00 AM 00:20:00 

Get-DnsServerResourceRecord -computername myDC -ZoneName contoso.com -rrtype A | Select HostName,RecordData
HostName                   RecordData              
--------                   ----------              
Machine1                   DnsServerResourceRecordA
Machine2                   DnsServerResourceRecordA
MAchine3                   DnsServerResourceRecordA

 I am not sure what I am missing. Using a ConvertToCSV instead of Select does the same substitution for the data.

Please explain what I did wrong.


1 Reply

Hi @chohman595 


IPv4Address isn't a string value in RecordData. That's the what you are missing.

Could you try that way?


Get-DnsServerResourceRecord -ComputerName myDC -ZoneName "contoso.com" -RRType A | Select-Object Hostname,@{Name="IPv4Address";Expression={$_.RecordData.IPv4Address.IPAddressToString }}