![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Count a users groups Hi, Im tying to enumerate the members of a partiular group and then for each member of that group count the total number of groups they belong too. I think im right to enumerate the group members and then I figured id need to do some kind of action for each member of the group to count the number of groups they belong too. Can anyone offer some guidance? |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Count a users groups "Gunna" <Gunna@xxxxxx> wrote in message news:A34E5035-C15D-4F5A-998E-93B543926436@xxxxxx Quote: > Hi, > > Im tying to enumerate the members of a partiular group and then for each > member of that group count the total number of groups they belong too. I > think im right to enumerate the group members and then I figured id need > to > do some kind of action for each member of the group to count the number of > groups they belong too. > > Can anyone offer some guidance? to enumerate all direct members. The Members method returns a collection of object references to the members, so you can retrieve other information about the members. For example, you can use the memberOf attribute of each member object to enumerate the DN's of the groups they are members of. There is no way to retrieve a count, so you must enumerate each DN and count. For example: ========== Option Explicit Dim objGroup, objMember, strGroup, lngCount Set objGroup = GetObject("LDAP://cn=MyGroup,ou=West,dc=MyDomain,dc=com") For Each objMember In objGroup.Members lngCount = 0 For Each strGroup In objMember.memberOf lngCount = lngCount + 1 Next Wscript.Echo objMember.sAMAccountName & " is a member of " _ & CStr(lngCount) & " groups." Next -- Richard Mueller MVP Directory Services Hilltop Lab - http://www.rlmueller.net -- |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Remove Users From All Groups | PowerShell | |||
| Users&Groups | Vista General | |||
| Windows XP, Users and Groups | PowerShell | |||
| How to do sysprep to make a image for my users and maintain the count on KMS server ? | Vista installation & setup | |||
| How to do sysprep to make a image for my users and maintain the count on KMS server ? | Vista General | |||