Decide whether a user is member of a group

  • Thread starter Thread starter peter71wallin
  • Start date Start date
P

peter71wallin

Hello,

We have a group named 'MyGroup'. In this group, other groups have been
added.
For example, the group 'UsersGroup' is a member of 'MyGroup'. The user
'MyUser'
is a member of 'UsersGroup'.

Now, I want to decide programatically whether the user 'MyUser' is a
member of 'MyGroup'.
The problem lies in that the user 'MyUser' is not directly a member of
'MyGroup. He is a member of 'UsersGroup', which in its turn is a member
of 'MyGroup'. So, the user is indirectly in the group 'MyGroup'.

How I do this? Please, enclose some code.

Thank you in advance, Peter Wallin
 
Peter said:
We have a group named 'MyGroup'. In this group, other groups have been
added.
For example, the group 'UsersGroup' is a member of 'MyGroup'. The user
'MyUser'
is a member of 'UsersGroup'.

Now, I want to decide programatically whether the user 'MyUser' is a
member of 'MyGroup'.
The problem lies in that the user 'MyUser' is not directly a member of
'MyGroup. He is a member of 'UsersGroup', which in its turn is a member
of 'MyGroup'. So, the user is indirectly in the group 'MyGroup'.

How I do this? Please, enclose some code.

Hi,

You describe nested groups. I have several VBScript examples of functions to
check for group membership linked here:

http://www.rlmueller.net/freecode1.htm
 
Joe said:
The most accurate mechanism is to recurse through the memberof
attributes of the user and all groups the user is a memberof.

If you are just looking for a tool to do this, go get

http://www.joeware.net/win/free/tools/memberof.htm

And, don't forget, there's that one calculated instance of group membership
using the primaryGroupID attribute, typically for the "Domain Users" group,
but it could be different in some circumstances.


--
Chuck Chopp

ChuckChopp (at) rtfmcsi (dot) com http://www.rtfmcsi.com

RTFM Consulting Services Inc. 864 801 2795 voice & voicemail
103 Autumn Hill Road 864 801 2774 fax
Greer, SC 29651

"Racing to save lives"
The Leukemia & Lymphoma Society - Team in Training
http://www.active.com/donate/tntsc/tntscCChopp

Do not send me unsolicited commercial email.
 
Back
Top