Google
Search WWW Search msexchangetips.blogspot.com

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


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.

23 Comments:

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 Unknown said...

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

Thanks a lot.

Regards,
Maddy

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 test said...

Thank you for posting this!!!!

6:11 AM  
Blogger Unknown 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 Anonymous said...

This article has saved me alot of time. Thanks!

2:40 AM  
Anonymous Anonymous 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...

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!

Catta

9:00 AM  
Anonymous Anonymous 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...

Capooooooo!!!

Groso!!!

Master!!!

God!!!

Salvator!!!

Thanks from Argentina
C. Castagnola!!!

1:47 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 Unknown 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  
Blogger xumeiqing said...

151202meiqing
oakley sunglasses wholesale
michael kors outlet
michael kors handbags
true religion
lebron james shoes
ugg outlet store
louis vuitton outlet
louis vuitton handbags
ray ban sunglasses outlet
celine
montblanc
canada goose jackets
coach factory outlet
michael kors outlet stores
uggs clearance sale outlet
ray ban sunglasses outlet
ugg boots on sale
ugg outlet
toms shoes
louis vuitton outlet stores
ugg boots
toms
ugg boots
abercrombie
cheap jordans
marc jacobs
cheap nfl jerseys
north face jacket
coach factory outlet
tory burch outlet
canada goose outlet
ray ban sunglasses
tods shoes
timberland boots
louboutin pas cher
uggs clearance
michaek kors outlet
coach outlet online
cheap oakleys
ugg outlet

5:36 PM  
Blogger John said...

coach outlet online
louboutin pas cher
cheap oakley sunglasses
ugg boots on sale
the north face outlet
nike air force 1
ugg boots
michael kors outlet online
beats by dre
ralph lauren outlet
canada goose
coach outlet online
chanel handbags
michael kors handbags
louis vuitton outlet stores
canada goose outlet
cheap jordans
uggs outlet
michael kors handbags
louis vuitton handbags
louis vuitton outlet
coach factory outlet
abercrombie & fitch
uggs on sale
oakley sunglasses wholesale
polo ralph lauren
michael kors outlet online
cheap soccer shoes
coach outlet store online
20151203yuanyuan

7:16 PM  
Blogger xumeiqing said...

151210meiqing
nike air max
prada uk
cheap oakleys
jordan shoes
ugg slippers
coach factory outlet
louis vuitton purses
louis vuitton
fitflops sale clearance
instyler curling iron
louis vuitton outlet
polo ralph lauren
michael kors outlet
air jordan retro
gucci outlet
jordan 11
timberland boots
oakley sunglasses
coach outlet
jordans for sale
michaek kors outlet
michael kors
coach outlet store online
hollister uk
jordan concords
coach outlet
uggs sale
michael kors handbags
cheap soccer shoes
louis vuitton
abercrombie
jordan retro
michael kors outlet clearance
louis vuitton outlet
uggs clearance sale outlet
oakley sunglasses
michael kors outlet online
louis vuitton
cheap uggs
ray-ban sunglasses

6:16 PM  
Anonymous Anonymous said...

michael kors outlet store
tiffany jewelry
jordan retro
fitflops
jordan shoes on sale
http://www.outlettiffanyand.co
christian louboutin outlet
michael kors outlet
air huarache shoes
michael kors handbags outlet
nfl jerseys
fitflops clearance
cheap tiffanys
nike zoom kobe
michael kors handbags,michael kors handbags clearance,michael kors clearance
michael kors outlet
michael kors outlet store
michael kors handbags
fitflops clearance
ray ban sunglasses outlet

7:23 PM  
Blogger chenlina said...

oakley sunglasses
longchamp bags
hermes bag
toms shoes
jordans
jordan 8s
ralph lauren polo
jordan concords
michael kors outlet
adidas shoes
michael kors outlet
michael kors handbags
jordan retro
nike roshe run
toms
louis vuitton handbags
cheap jordan shoes
jordan shoes
michael kors outlet clearance
coach factory outlet
adidas ultra boost
christian louboutin sale
nike air max 90
louis vuitton outlet
louis vuitton bags
abercrombie and fitch
michael kors outlet online
burberry outlet
nike factory outlet
polo ralph lauren
coach outlet online
adidas uk
air jordans
fitflop sandals
kobe 11 shoes
michael kors outlet online sale
coach outlet
ray ban sunglasses
michael kors canada
juicy couture
chenlina20160803

5:47 PM  
Blogger Unknown said...

birkenstock shoes
prada bags
fitflops sandals
nike air max 2017
ferragamo outlet
tory burch handbags
coach outlet store online
christian louboutin sneakers
converse sneakers
michael kors purses
2017.4.6chenlixiang

11:39 PM  

Post a Comment

<< Home

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