Try this filter: (&(objectClass=user)(!(objectClass=computer)))
LDAP Query that exclude computers
-
15-03-2022 - |
Question
I had never done any DAP/AD admin or querying. Right now I have a task where I need to get all the USERS in our company's AD; but keep getting computers in the query's result. I use objectClass=user and still get all the computers in the AD. What else am I missing? Is there a way to say "objectClass=user and not objectClass=Computer"? thanks!
La solution
Autres conseils
If you are here in 2019, the answer above is now irrelevant. I have been using the below and it works perfectly, using operators
Get-ADObject -IncludeDeletedObjects -Filter {(ObjectClass -eq "user")
-and (-not (objectClass -eq "computer")) -and (Deleted -eq $true)}
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow