Want all DC's resource records from DNS

I have this one liner:

Get-DnsServerResourceRecord -ZoneName “dev.corp.com” -RRType Srv | Where-Object {$_.RecordType -contains “SRV”}

…and I get all SRV records fine, but i want to winnow down to a specific host, so tried this:

Get-DnsServerResourceRecord -ZoneName “dev.corp.com” -RRType Srv | Where-Object {$_.RecordData -contains “DC_008”}

I tried

Get-DnsServerResourceRecord -ZoneName “dev.corp.com” -RRType Srv | gm

…to discover a MemberType Property of “RecordData” but coming up empty.

How should I define my Where-Object?

thank you.

The RecordData object has a DomainName property. Try this:

Get-DnsServerResourceRecord -ZoneName "dev.corp.com" -RRType Srv | Where-Object {$_.RecordData.DomainName
-like '*DC_008*'}

 

Thanks Matt,

Helping myself, how do I find a given object’s additional properties, if not with Get-Member?

I used Get-Member but expanded the property:

 Get-DnsServerResourceRecord -ZoneName "contoso.com" -RRType Srv | Select -expandproperty Recorddata | Get-Member 

fantastic, thank you very much

I’m lazy and I like to do it like this. One of the many great things about PS, many ways to accomplish the same task!

(Get-DnsServerResourceRecord -ZoneName "domain.local" -RRType srv).recorddata | GM