Where-object on multiple valued property

Get-DNSClientServerAddress

returns a column named “Server addresses,” that contains ip addresses inside of squiggly lines. i want to find each interface that has a dns server with “10.” in its ip.

Get-DNSClientServerAddress | ? serveraddresses -contains “10.”"

“Get-DNSClientServerAddress | ? serveraddresses | get-member” says this is a “Selected.Microsoft.Management.Infrastructure.CimInstance” type, and it has a noteproperty named ‘serveraddreses’.

but i can’t get it to work with contains, like, $.serveraddresses.serveraddresses, $($.serveraddresses).serveraddresses, or anything else i tried. how can i filter this with a where?

(edit, this forum is removing the underscores after my dollar signs)

Have you tried

Get-DNSClientServerAddress | ? {$_.ServerAddresses -match '10'}

You have to format your code as code to preserve special charachters. :wink: Simply clikc on the “preformated” ( </> ) icon on the format bar of the post editor.
You can edit your existing post to correct the formatting. You should not create a new one.

You may use a loop to extract all individual serveraddresses top be able to compare them to your condition.

thank you. that was too easy, and i feel dumb. but i now that i look at it, i did lie in my original post, and i specifically need them to start with 10, not just contain 10. so i think

-match "^10\."

does it.

Glad you got it figured.