Active Directory Cookbook for windows server 2003- P23:If you are familiar with the O'Reilly Cookbook format that can be seen in other popular books, such as the Perl Cookbook, Java Cookbook, and DNS and BIND Cookbook, then the layout of this book will not be anything new to you. The book is composed of 18 chapters, each containing 10-30 recipes for performing a specific Active Directory task. Within each recipe are four sections: problem, solution, discussion, and see also. | end if end if next End Function Discussion As described in Recipe group membership is stored in the multivalued member attribute on group objects. But that attribute will not show the complete picture because group nesting is allowed in Active Directory after you ve transitioned from mixed mode. To view the complete group membership you have to recurse through each group s members. In the VBScript example I used a dictionary object referred to as a hash or associative array in other languages to ensure I did not get in an infinite loop. The dictionary object stores each group member before the DisplayMembers function is called a check is performed to determine if the group has already been evaluated. If so a message is displayed indicating the group will not be processed again. If this type of checking was not employed and you had a situation where group A was a member of group B group B was a member of group C and group C was a member of group A the loop would repeat without terminating. See Also Recipe for viewing group membership and MSDN IADsMember Recipe Adding and Removing Members of a Group Problem You want to add or remove members of a group. Solution Using a graphical user interface 1. Follow the same steps as in Recipe to view the members of the group. 2. To remove a member click on the member name click the Remove button click Yes and click OK. 3. To add a member click on the Add button enter the name of the member and click OK twice. Using a command-line interface The -addmbr option adds a member to a group dsmod group GroupDN -addmbr MemberDN 231 The -rmmbr option removes a member from a group dsmod group GroupDN -rmmbr MemberDN The -chmbr option replaces the complete membership list dsmod group GroupDN -chmbr Member1DN Member2DN . . . Using VBScript This code adds a member to a group. ----- SCRIPT CONFIGURATION ------- strGroupDN GroupDN . cn SalesGroup ou Groups dc rallencorp dc com .