![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Re: Enumerate User's AD Group Membership "Dennis B." <dbiscontin@xxxxxx> wrote in message news:%236rXoqR%23JHA.4376@xxxxxx Quote: > I'm just wondering if anyone has written a function that returns an > *array* of a user's AD group membership. It's for a logon script and I'd > rather enumerate the user's group membership once at the beginning of the > script rather than for each confitional statement (for mapping drives, > printers, etc.). Example: > > -- > Dim UsersGroups() 'global dynamic array > UsersGroups = GetGroups() > If InGroup("Managers") = True Then > ' map drives, printers, etc > End If > > Function InGroup(GroupName) > ' Iterate thru UsersGroups, check membership & return boolean > End Function > > Function GetGroups() > ' returns an array of groups, eg: array(0)="Managers", array(1)="Staff", > etc > ' must be a recursive function so that groups in groups are enumerated > End Function > -- > > GetGroups is the function I'm after. Many thanks. > > Cheers, > Dennis. http://www.rlmueller.net/freecode1.htm They are designed to retrieve memberships once and maintain them in a dictionary object for efficiency. For one user (and no need to check computer group membership), I recommend IsMember Function 2 (IsMember2.vbs), unless you also need to check membership in the "Primary" group, in which case you can use IsMember Function 4. -- Richard Mueller MVP Directory Services Hilltop Lab - http://www.rlmueller.net -- |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Re: Enumerate User's AD Group Membership | VB Script | |||
| Enumerating user's universal groups membership from ANOTHER DOMAIN | VB Script | |||
| Get group membership | PowerShell | |||
| Enumerating user's universal groups membership from ANOTHER DOMAIN | VB Script | |||
| Group Membership | Vista mail | |||