Search WWW Search

Tuesday, August 07, 2007

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


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

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.


James Chong (MVP)MCSE M+, S+, MCTS, Security+

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


Blogger Support said...


This article is good and informative.

yours truly,

1:09 AM  
Anonymous Anonymous said...

I love you!!

You saved me hours and hours...
Keep up the good work, I have your blog in my Bookmarks and come back to it constantly

8:52 AM  
Blogger madhavan said...

Really useful info, it worked and saved lot of time for me.

Thanks a lot.


4:16 AM  
Anonymous Anonymous said...

Thanks a bunch! Exactly the quick script our organization was seeking.

1:34 PM  
Anonymous Anonymous said...

Thanks a bunch! Exactly the quick script our organization was seeking.

1:35 PM  
Blogger Robert said...

Thank you for posting this!!!!

6:11 AM  
Blogger David said...

I'm not able to get the script to work. Not enough information. Need an exampl.

8:17 AM  
Blogger Mick Tripps said...

I changed "mysourcegroup" and "mytargetgroup" to the correct group names, but the script fails with this error. What did I miss? Does the script have to be run from the Exchange server? Do any other values in the example have to be changed? Thank you.


C:\>cscript copy_group.vbs
Microsoft (R) Windows Script Host Version 5.7
Copyright (C) Microsoft Corporation. All rights reserved.

C:\copy_group.vbs(3, 1) (null): A referral was returned from the server.

10:40 AM  
Anonymous Martijn said...

This article has saved me alot of time. Thanks!

2:40 AM  
Anonymous KeithL said...

I tried the scrip and it runs without error, but does not populate the target group. My groups are universal groups, I am wondering if that matters?

8:02 AM  
Anonymous Anonymous said...

I think 2moons dil changes my life. Because of 2moons gold, I meet a lot of friends. Besides, my friends usually give me some 2moon dil. I usually buy 2moons dil through Internet and advice from my friends, so I gain a lot of cheap 2moons gold and harvest in life.

9Dragons is a very good game. Through buying 9Dragons gold, I find fun in it. I am so glad that I can earn a lot of 9 Dragons gold. 9Dragons cater to the taste of young people. With cheap 9Dragons gold, you can get everything you want in this game. So I like to buy 9 Dragons gold. For me 9Dragons money is not just a simple thing.

7:44 PM  
Anonymous cheap rappelz rupees said...

I like play online game, I also buy ragnarok online zeny and ro zeny, the ragnarok zeny is very cheap, and use the iro zeny can buy many things, I like cheap zeny, thanks, it is very good.

I like play online game, I also buy rupees and rappelz rupees, the rappelz gold is very cheap, and use the rappelz money can buy many things, I like cheap rappelz rupees, thanks, it is very good.

6:08 PM  
Anonymous Anonymous said...

Thanks.. It works amazing.. awesome

2:54 PM  
Anonymous Anonymous said...

Thanks for the script, managed to get it working after lots of trial & error.

Seems the script is very fussy on upper / lower case characters. Also had to create the new distribution list and put it into the correct OU before it would work, and had to make sure that both old and new DL's were global not universal.

Hope that helps somebody.

7:44 AM  
Anonymous Anonymous said...

Thank you so much - you saved my day! :-)

May it is helpful to use add. the MS-Tool ldp (Server support tools) it helps you figure out the right LDAP path information, I had trouble with them first ;-).

Clear, straight forward help as needed. - Thank you!


9:00 AM  
Blogger 123 123 said...

Interesting article you got here. I'd like to read a bit more about this matter. Thnx for posting that info.
Sexy Lady
Blonde escort

6:23 AM  
Anonymous Anonymous said...






Thanks from Argentina
C. Castagnola!!!

1:47 PM  
Anonymous Anonymous said...

The Hogan scarpe
brand is distinctive for high quality. Hogan scarpe donna
are the highest expression of a new luxury lifestyle. hogan donna
is meant for someone who cherishes the type of luxury associated. Apparently Ben had extra spikes put in his Hogan scarpe uomo
for extra grip.

6:20 PM  
Anonymous Tech solution said...

Thanks for the solution, it works fine

10:53 PM  
Anonymous Anonymous said...

working brilliant
thank you

9:29 AM  
Blogger oakleyses said...

louis vuitton outlet, oakley sunglasses, michael kors handbags, cheap jordans, prada handbags, uggs outlet, michael kors outlet, oakley sunglasses, uggs on sale, ray ban sunglasses, burberry outlet, tiffany jewelry, uggs on sale, kate spade, gucci handbags, ray ban sunglasses, prada outlet, longchamp outlet, louboutin uk, burberry factory outlet, tory burch outlet, nike air max, tiffany jewelry, christian louboutin, louboutin shoes, oakley sunglasses, cheap oakley sunglasses, chanel handbags, michael kors outlet store, louis vuitton outlet, nike outlet, ralph lauren polo, louis vuitton, christian louboutin, michael kors outlet online, longchamp outlet, uggs outlet, michael kors outlet online, nike air max, longchamp bags, replica watches, ralph lauren outlet, oakley sunglasses, ray ban sunglasses, louis vuitton outlet online, nike free, michael kors

6:40 PM  
Blogger oakleyses said...

burberry pas cher, lunette oakley pas cher, coach outlet, kate spade outlet, true religion jeans, converse, coach outlet, longchamp soldes, north face uk, michael kors, louboutin pas cher, new balance, lululemon outlet, coach purses, nike air max, hermes pas cher, nike tn pas cher, vans pas cher, coach outlet store online, mulberry uk, lunette ray ban pas cher, nike air max uk, sac guess pas cher, nike air force, nike roshe run pas cher, longchamp pas cher, north face pas cher, nike air max pas cher, ray ban uk, true religion outlet, abercrombie and fitch, polo lacoste pas cher, true religion outlet, michael kors, jordan pas cher, nike free, polo ralph lauren uk, vanessa bruno pas cher, true religion outlet, hogan sito ufficiale, ralph lauren pas cher, michael kors outlet online, nike free pas cher, nike roshe uk, abercrombie and fitch UK, nike blazer pas cher, hollister uk

6:42 PM  
Blogger oakleyses said...

converse shoes outlet, salvatore ferragamo, timberland boots, softball bats, herve leger, ray ban, hollister, louboutin, gucci, nike roshe run, iphone cases, beats by dre, mcm handbags, oakley, p90x workout, insanity workout, wedding dresses, abercrombie and fitch, abercrombie, nike air max, mac cosmetics, babyliss pro, valentino shoes, bottega veneta, mont blanc, converse, jimmy choo outlet, hollister clothing, nike air max, north face outlet, new balance shoes, north face outlet, instyler ionic styler, soccer shoes, lululemon outlet, asics running shoes, ghd hair, giuseppe zanotti, soccer jerseys, nfl jerseys, longchamp uk, reebok outlet, nike air huarache, chi flat iron, hermes handbags, vans outlet, polo ralph lauren, celine handbags, nike trainers uk, vans scarpe

6:45 PM  
Blogger oakleyses said...

toms shoes, supra shoes, montre pas cher, ugg uk, juicy couture outlet, moncler, lancel, michael kors outlet online, ugg pas cher, michael kors handbags, barbour, doke & gabbana, michael kors outlet, coach outlet, louis vuitton uk, canada goose jackets, pandora charms, moncler, ugg,ugg australia,ugg italia, links of london uk, moncler jackets, hollister, juicy couture outlet, canada goose outlet, swarovski uk, pandora jewelry, canada goose pas cher, canada goose outlet, marc jacobs, moncler pas cher, thomas sabo uk, swarovski jewelry, karen millen uk, louis vuitton, moncler, moncler uk, sac louis vuitton, canada goose, moncler outlet, louis vuitton, canada goose, wedding dresses uk, ugg,uggs,uggs canada, canada goose uk, sac louis vuitton, moncler, replica watches, barbour jackets uk, bottes ugg pas cher, canada goose jackets

6:50 PM  
Blogger Minko Chen said...

true religion jeans sale
mlb jerseys
cheap jordan shoes
michael kors uk
michael kors outlet
coach outlet store
louis vuitton outlet store
lacoste pas cher
michael kors handbags wholesale
coach outlet online
michael kors outlet
true religion outlet
cheap ugg boots
michael kors handbags
rolex watches,rolex watches,swiss watches,watches for men,watches for women,omega watches,replica watches,rolex watches for sale,rolex replica,rolex watch,cartier watches,rolex submariner,fake rolex,rolex replica watches,replica rolex
oakley sunglasses
cheap ray ban sunglasses
longchamp handbags outlet
giuseppe zanotti outlet
hermes birkin bag

6:52 PM  

Post a Comment

<< Home

xml:lang="en" lang="en"> MS Exchange Tips: Active Directory: Copy Distribution List Members to Another Distribution List