"Dennis B." <dbiscontin@xxxxxx> wrote in message
news:%236rXoqR%23JHA.4376@xxxxxxI have several VBScript functions linked here:
> 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
--


