Hi
I’ve encountered a problem and after half a day faffing about i’m still stumped.
So the following code works:
Get-ADUser -filter {my-custom-attribute -eq 6} -SearchBase 'OU=Users,DC=my,DC=local'
And this does not:
Get-ADUser -filter * -SearchBase 'OU=Users,DC=my,DC=local' ` | Where-Object {$_."my-custom-attribute" -eq 6}
The first code returns a list of all users where my-custom-attribute is equal to 6; the second code returns nothing. If i use a property like samaccountname in the second example it returns what i would expect. So at this point, after much fiddling about, i think my problem might be down to a fundamental misunderstanding of how the $_ variable works but it’s hard to tell!
I would very much appreciate a shove in the right direction.
Cheers