user18349
user18349

Reputation: 21

How to search extended attributes with filter?

I want to find all users who do not have a value for the extended attribute manager. Is this possible to do with the -Filter parameter or must I pipe to Where-Object?

I have tried all of the following:

$test = Get-ADUser -Filter 'Manager -notlike "*"'
$test = Get-ADUser -Filter 'Manager -ne "*"'
$test = Get-ADUser -Properties * -Filter 'Manager -notlike "*"'
$test = Get-ADUser -Properties * -Filter 'Manager -ne "*"'

Upvotes: 0

Views: 1960

Answers (1)

Ansgar Wiechers
Ansgar Wiechers

Reputation: 200233

Not with -Filter, but with -LDAPFilter:

Get-ADUser -LDAPFilter '(!(manager=*))'

assuming that you want all users who don't have a manager assigned.

Upvotes: 2

Related Questions