Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
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.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - Re: Enumerate User's AD Group Membership

Reply
 
Old 06-29-2009   #1 (permalink)
Richard Mueller [MVP]


 
 

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.
I have several VBScript functions linked here:

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 SpecsSystem Spec
Reply

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


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46