Hello Al,
http://www.microsoft.com/technet/scr....mspx?mfr=true
If your script is complete, you never actually performed the query. Try
something like this:
set arrGmembers = GetObject("LDAP://OU=x,OU=y,ou=z zz,ou=a,DC=b,DC=c,DC=d,DC=com")
arrGmembers.GetInfo
arrGmembers = objGroup.GetEx("members")
The other thing that will cause that is if a group has one or fewer members.
In that case, the return is a single item rather than an array/collection.
You can test for that with "IF isArray(arrGmembers) ". Otherwise the for/each
will fail.
Test with groups that have 0, 1 and 2 members. If it works with all three,
then you're set.
> I have a vbs script and I've created a sub routine to pull the members
> of the groups in one of our OU's. I would like the script to return
> all groups and the members that don't meet a certain naming
> convention. Here is my subroutine:
>
> *************************************
> Sub GetMembers(GroupName)
> arrGmembers = "LDAP://OU=x,OU=y,ou=z zz,ou=a,DC=b,DC=c,DC=d,DC=com"
> Flag = 0
>
> For Each member In arrGmembers
> If (Left(Member,3) <> "ad#_") Then Flag = 1
> Next
>
> If Flag Then WScript.Echo GroupName & "Contains non ad#_ accounts!!!
> Need to remove"
>
> End Sub
> *****************************************
> Well I get an error for this line "For Each member In arrGmembers" It
> says "Object not a collection" OK so it needs to be a collection? How
> do I do that?
>
> Thanks!
> al