How to find any propertie that has a specific value

Hi,

Newbie question maybe…
I know that to find specific properties of an object I use this command:

Get-DistributionGroup support | fl Object

Is there a way to find any properties that have a specific value?
Like: I want to know every properties that have the value support in it…

That’d be the Where-Object command.

Get-Something | Where { $_.Property -like ‘value’ } | Format-Table

Don Jones,

First, thanks for always replying.
Didn’t worked for me…

The "$.Property" I should change for the property that I want to check?
Tried that to get every properties with my name as a value:

Get-ADUser username | Where {$
.Property -like “Vandr”} | Format-Table

Nothing returned…
I expected to get returned: DistinguishedName, GivenName and Name

This is really ugly and I’m sure there’s a more efficient way of doing it, but this will technically achieve the output you’re expecting:

$User = Get-ADUser username
$UserProps = $User | Get-Member -MemberType Properties | select -ExpandProperty Name
foreach ($Prop in $UserProps) {
    $Prop | ? {$User.$Prop -like 'Vandr*'}
}

Wilson Acosta,

Thanks!
I don’t know if there is a prettier way of doing this too…
Added something more to get the results that I want:

$User = Get-ADUser username
$UserProps = $User | Get-Member -MemberType Properties | select -ExpandProperty Name
$Properties = foreach ($Prop in $UserProps) {
    $Prop | Where {$User.$Prop -like "Vandr*"}
}
$Properties -join(",")
$User | select $Properties | Format-List
Get-ADUser -Filter 'Name -like "*Vandr*"'

random commandline,

That command only returns every user on AD that has “vandr” on it’s name.