How do I show the properties of a Property?

I’m trying to put a script together and need to get at a property that is inside another property.


DnsServerResourceRecord -ZoneName -ComputerName DNSServer -RRType txt -Name _dmarc |GM

…and I see

RecordData                Property   CimInstance#Instance RecordData {get;set;} 

…but I know there’s a Description field in there that I want to write to. How can I expose this and any other properties that are inside of the first level of a Property set?


I’m not able to test your particular cmdlet but usually you expand the content of a property with a Select-Object -ExpandProperty “Name Of The Property”.

You can also do this:

$foo = DnsServerResourceRecord -ZoneName -ComputerName DNSServer -RRType txt -Name _dmarc
$foo.RecordData | Get-Member

or just

$(DnsServerResourceRecord -ZoneName -ComputerName DNSServer -RRType txt -Name _dmarc).RecordData | Get-Member

One line :

((DnsServerResourceRecord -ZoneName $env:USERDNSDOMAIN -ComputerName ($(Get-ADDomainController).Name) -RRType 'A')[0]).RecordData | Get-Member


thanks Olaf

for some reason, this doesn’t return what I wanted but the above two posters did have the info I was seeking. Thanks