I have a PSObject which looks like that:
Name : Full Name givenname : Full surname : Name emailaddress : email@domain.com Direct : xxx Mobile : xxx Prop1 : TRUE Prop2 : TRUE Prop3 : TRUE Prop4 : TRUE Prop5 : TRUE Prop6 : TRUE Prop7 : Prop8 :
I want to get all the property names that have a TRUE
value.
I can get this info on that way:
$Props = $Object | Get-Member -MemberType NoteProperty |
Select -ExpandProperty Name
$temp = @()
foreach ($prop in $Props) {
if ($Object.$Prop -eq $true) {
$temp += $prop
}
}
But I wonder if there's a better/easier method.