Skip to main content

Active Directory: Copy Distribution List Members to Another Distribution List

Summary: In this example, we will copy all members from one Distribution Group to another Distribution Group.

Copy the contents below and save as copymembers.vbs to C: drive


Const ADS_GROUP_TYPE_GLOBAL_GROUP = &H2

Set objOU = GetObject("LDAP://OU=Security Groups, dc=company, dc=com")
Set objOldGroup = GetObject("LDAP://CN=mysourcegroup, ou=security groups, dc=company, dc=com")
Set objNewGroup = GetObject("LDAP://CN=mytargetgroup, ou=security groups, dc=company, dc=com")

On Error Resume Next
For Each objUser in objOldGroup.Member
objNewGroup.Add "LDAP://" & objUser
Next


Open Command prompt:

C:\>cscript copymembers.vbs


The script will copy all members in the "mysourcegroup" Distribution List to your "mytargetgroup" Distribution List.


Note: Some organizations like to use # in front of their Distribution List names so they appear together in the GAL. Because this is a special character it will need to be in double quotes to treat # as a literal.

Example:
("LDAP://""CN=mysourcegroup""


James Chong (MVP)MCSE M+, S+, MCTS, Security+
msexchangetips.blogspot.com

How useful was this article? Want to see a tip not listed? Please leave a comment.

Facebook

Facebook Recommendations

Followers


Web Designing In Karachi



Haroof.com


Politics blogs

My Zimbio

Email Subscribe

Enter your email address:

Watch online Live TV

Popular posts from this blog

BRITISH FIRM TO INTRODUCE DISSOLVABLE POLYTHENE BAGS IN KARACHI.

CNews Karachi. July 05: A Pakistani Scientist in Britain has invented a new chemical for processing plastic (polythene) bags which has the quality of dissolution after its use in 105 days.A manufacturing unit for these plastic bags was being set up in Turkey while interest has been shown in the setting up of a big unit and manufacturing firm’s head quarter in Karachi which will be used to supply such dissolvable polythene bags to Asian countries. The Director of UK based firm Bio Plast Biodegradable Plastics GL Punn while leading a 15 member delegation called on EDO Municipal Services City Government Masood Alam. The Executive Director of Bio Plast Pakistan Muhammad Hanif Awan and M. Sultan Mehmood Awan was also present on this occasion. The Director of Bio Plast informed the EDO Municipal Services about the characteristics of new chemical. He said that the firm was going to set up its first plant in Turkey which will be operative in next two months. The delegation also praised the vi

Admission Open in Class XI in Pre-Engineering, Pre-Medical, and Commerce Groups at BODMAS MODEL COLLEGE, North Nazimabad, Karachi

  Admission Open in Class XI in Pre-Engineering, Pre-Medical, and Commerce Groups at BODMAS MODEL COLLEGE, North Nazimabad, Karachi.

Matric General Group Result SECONDARY SCHOOL CERTIFICATE (S. S. C.) PART - II CLASS - X - 2010 (www.apnieyesp.com )

PASSED THE SECONDARY SCHOOL CERTIFICATE (S. S. C.) PART - II CLASS - X) ANNUAL EXAMINATION, 2010. ERRORS AND OMISSIONS EXCEPTED, CANDIDATES BEARING THE FOLLOWING ROLL NUMBERS ARE DECLARED TO HAVE PASSED THE SECONDARY SCHOOL CERTIFICATE (S. S. C.) PART - II CLASS - X) ANNUAL EXAMINATION, 2010. ------------------------------------------------- GENERAL GROUP (REG&PVT) --- GRADE..'A-ONE' ---- ----------------------- ( CANDIDATES SECURING TOTAL MARKS 680 AND ABOVE) MARKS SECURED BY THE CANDIDATES OUT OF TOTAL MARKS OF 850 ARE MENTIONED AGAINST EACH ROLL NUMBER IN BRACKET --------------------------------------------------- 601086 (689) XXX (XXX) XXX (XXX) XXX (XXX) XXX (XXX) XXX (XXX) 601327 (681) 363 (684) 364 (719) 407 (685) 664 (682) 788 (687) 601836 (692) 882 (683) XXX (XXX) XXX (XXX) XXX (XXX) XXX (XXX) 602315 (723) 316 (715) 320 (712) 321 (739) 325 (686) 326 (702) 602327 (683) 329 (70

Labels

Show more