Richard
Fri Jan 26 12:11:34 CST 2007
Epoh Rio wrote:
> How can I return a list of AD users, omitting the built-in users?
>
You probably mean users like Administrator and Guest. There is no way to
query for users except these. You can't even query for all users except
those in the cn=Users container.
If all non built-in users are in one OU and it's children, you can use this
OU as the base of the query. Otherwise, you could place all built-in users
in a group and query for all users that are not members of that group. For
example, create a group called Builtin in the cn=Users container. Make
Administrator, Guest, IUSR_server, IWAM_server, krbtgt members of this
group. Then to query for all other users:
(&(objectCategory=person)(objectClass=user)(!memberOf=cn=Builtin,cn=Users,dc
=MyDomain,dc=com))
where "!" is the NOT operator. You must specify the full Distinguished Name
of the group members to exclude. Note you cannot exclude the container or OU
the object resides in.
--
Richard
Microsoft MVP Scripting and ADSI
Hilltop Lab web site -
http://www.rlmueller.net
--