cannot filter for empty company attribute

by fgc at 2012-12-20 14:20:45

I was trying to get all users with empty company attribute - like this:

get-aduser -properties Company -filter {Company -eq $null} or:
get-aduser -properties Company -filter {Company -eq "" }

but none of these worked. I know that using the "where" statement will work,
(get-aduser -filter * -properties * | where {$_.company -eq $null } ) , but I was trying to do it with the -filter expression.

Yours
FGC
by mikefrobbins at 2012-12-20 16:43:57
get-aduser -properties Company -filter {Company -notlike "*"}
by fgc at 2012-12-20 23:08:09
Great! - thanks a lot … :slight_smile: