Posts

Showing posts from October, 2020

Getting the Text Representation of a Microsoft DNS record using PowerShell Get-DnsServerResourceRecord cmdlet

Image
Within Microsoft DNS server you'll see your zones and resource records. Under the data column you'll see a nice simply text representation of each resource record. This was also available back in the old days with the MicrosoftDNS_ResourceRecord WMI class. https://docs.microsoft.com/en-us/windows/win32/dns/microsoftdns-resourcerecord When using the new PowerShell cmdlet you'll find that each DNS record has its own strongly typed class which properties appropriate for each each resource type. Nice. But you just want the full text representation. So you call ToString()... Problem. The ToString() method just returns the type name. This is from CimInstance. Which is strange because when you look at the resource records as a collection they display a cut down version of the resource record text representation, this is the same output piping each resource record to Format-Table. Even more interesting, piping a resource record to Format-List you get the full information as a textu...