Windows Vista Tips

Windows Vista Tips > Newsgroups > Windows Server > Scripting > Re: chech group

Reply
Thread Tools Display Modes

Re: chech group

 
 
Richard Mueller [MVP]
Guest
Posts: n/a

 
      11-14-2008

<> 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
--


 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: A Direct link to the WGA Download that is causing so much problem...Found on another group...(Stationery Group) BugZ Windows Update 0 03-02-2006 04:49 PM
Re: A Direct link to the WGA Download that is causing so much problem...Found on another group...(Stationery Group) BugZ Windows Update 2 03-02-2006 04:31 PM
Re: A Direct link to the WGA Download that is causing so much problem...Found on another group...(Stationery Group) Neal Windows Update 2 03-02-2006 03:48 PM
Re: unable to bind to group (adding users to dist. group en masse) Paul Bergson Active Directory 1 10-31-2005 12:17 PM
can't see group when adding a group or a user to a group... ERIC Active Directory 2 03-06-2005 09:43 PM



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 47 48 49 50 51 52 53 54 55 56 57 58 59