Ok sorry, I am confused, your subject says one thing and your post said
another.
If you want users who are direct members of a group, then you want to
look at the member attribute of the group.
If you want users who are NOT direct members of a group, then you do as
Richard indicated and do a NOT (!) of the memberof attribute of the users.
Now there are a couple of things that can impact this.
As Richard mentioned, there is primary group. Primary group membership
is not handled in the way other group membership is handled.
The other possible issue is group nesting, if a group has nested
membership, the only way to figure out what is going on is to either use
tokengroups (which can't be searched against) but will allow you to get
all local domain group memberships for a given user in one call or you
get to chase nesting with recursion.
Finally, if you have multiple domains this gets even more confusing
because you can't easily use memberof to figure anything out when the
group exists in one domain and the users exist in another.
joe
--
Joe Richards Microsoft MVP Windows Server Directory Services
Author of O'Reilly Active Directory Third Edition
www.joeware.net
---O'Reilly Active Directory Third Edition now available---
http://www.joeware.net/win/ad3e.htm