Board index » Visual Studio » Problem with script to find users who are members of a group

Problem with script to find users who are members of a group

Visual Studio91
Hello.

I have found this script in the script repository and have used it to find

users who are members of a particular AD group.

It works for most cases.

One of the cases that do not work correctly is when an AD group has over

5000 members in it. It only returns about 15 members when I know it has over

5000.



Does anyone know why?

Is it because of the local property cache?











------------------------------------------------------------------------

On Error Resume Next



Set objGroup = GetObject _

("LDAP://cn=Scientists,ou=R&D,dc=NA,dc=fabrikam,dc=com")

objGroup.GetInfo



arrMemberOf = objGroup.GetEx("member")



WScript.Echo "Members:"

For Each strMember in arrMemberOf

WScript.echo strMember

Next

------------------------------------------------------------------------


-
 

Re:Problem with script to find users who are members of a group



The first thing to do is comment the line that reads "On Error Resume

Next" - this is hiding all error messages from you.







-

Re:Problem with script to find users who are members of a group

Hi Marty List.

I have already tried that.

The script did not produce any error messages.







"Marty List" wrote:



Quote


The first thing to do is comment the line that reads "On Error Resume

Next" - this is hiding all error messages from you.









-

Re:Problem with script to find users who are members of a group

CCIIW but, I believe there is a limitation in vbScript. I have run into the

same issue with a group showing no members when actually all users in my OU

are members, as if it were an "Everyone" group.



If there is another answer, I would very much like to know....



Todd....



"Johnny" wrote:



Quote
Hello.

I have found this script in the script repository and have used it to find

users who are members of a particular AD group.

It works for most cases.

One of the cases that do not work correctly is when an AD group has over

5000 members in it. It only returns about 15 members when I know it has over

5000.



Does anyone know why?

Is it because of the local property cache?











------------------------------------------------------------------------

On Error Resume Next



Set objGroup = GetObject _

("LDAP://cn=Scientists,ou=R&D,dc=NA,dc=fabrikam,dc=com")

objGroup.GetInfo



arrMemberOf = objGroup.GetEx("member")



WScript.Echo "Members:"

For Each strMember in arrMemberOf

WScript.echo strMember

Next

------------------------------------------------------------------------





-