Submitted By: Amit Tank

Copies the group membership from one group to another.

Visual Basic
Edit|Remove
strSGroupDN = InputBox ("Enter the DN of Source Group" & VBCRLF &_
                  vbcrlf& _
                  vbcrlf& _
                  "e.g. CN=Source Group,OU=Users,DC=NWTraders,DC=com")
strDGroupDN = InputBox ("Enter the DN of Destination Group" & VBCRLF &_
                  vbcrlf& _
                  vbcrlf& _
                  "e.g. CN=Destination Group,OU=Users,DC=NWTraders,DC=com")
 
set dicSeenGroupMember = CreateObject("Scripting.Dictionary")
set objDGroup = GetObject("LDAP://" & strDGroupDN)

DisplayMembers "LDAP://" & strSGroupDN, dicSeenGroupMember
Function DisplayMembers (strGroupADsPath, dicSeenGroupMember)
   set objGroup = GetObject(strGroupADsPath)
   for each objMember In objGroup.Members
       objDGroup.Add("LDAP://" & objMember.distinguishedName)
    next
End Function

MsgBox "Group Members have been copied to Destination Group"