<> wrote in message
news:c271528e-17d9-4ae7-a75a-...
On 14 Lap, 10:56, kov...@gmail.com wrote:
> why this function does'nt check "Domain Users" group???
>
> Function RecursiveIsMember(strGroup, arrGroups, x)
> ' Return Type: Boolean
> ' Goes through Nested Groups until either booIsMember is True
> or there are no more groups to check
>
> Dim objADSystemInfo, objUser, objGroup
> Dim strGroupDN
> Dim arrTemp
> Dim booIsMember
>
> booIsMember = False
>
> On Error Resume Next
> If Not IsArray(arrGroups) Then
> Set objADSystemInfo = CreateObject("ADSystemInfo")
> Set objUser = GetObject("LDAP://" &
> objADSystemInfo.UserName)
> arrGroups = objUser.GetEx("memberOf")
> Set objUser = Nothing
> Set objADSystemInfo = Nothing
> End If
>
> For Each strGroupDN in arrGroups
> Err.Clear
> Set objGroup = GetObject("LDAP://" & strGroupDN)
> ' WScript.Echo Space(x) & objGroup.Get("name")
> If Err.Number = 0 Then
> If LCase(objGroup.Get("name")) = LCase
> (strGroup) Then
> booIsMember = True
> Exit For
> Else
> Err.Clear
> arrTemp = objGroup.GetEx("memberOf")
> If Err.Number = 0 Then
> y = x + 2
> booIsMember = RecursiveIsMember
> (strGroup, arrTemp, y)
> If booIsMember = True Then
> Exit For
> End If
> End If
> End If
> End If
> Set objGroup = Nothing
> Next
> On Error Goto 0
> RecursiveIsMember = booIsMember
> End Function
I found that "Domain Users" is the primary group, how to fix the
script to check priemary grooups also,
many thanks
============
One of these examples should help:
http://www.rlmueller.net/freecode1.htm
The best method to retrieve all security group memberships, nested, primary,
etc., but not distribution or cross-domain memberships, is to use the
tokenGroups attribute. Example 5 in the link for example.
--
Richard Mueller
MVP Directory Services
Hilltop Lab -
http://www.rlmueller.net
--