Copy users from one group to another in Active Directory

I need to copy the the users in a group into another group.  I dont want to add the group itself because I am going to delete it.  This is in an exchange 2007 environment.  Thanks
TriCountyITAsked:
Who is Participating?
 
PoorImpulseControlConnect With a Mentor Commented:
you can use the ds* commands to accomplish it fairly quickly.

Assuming you created the group "NewGroup" in the OU "MyUsers" in the AD domain MyAD.local, and you wanted to copy all the users from OldGroup into NewGroup (this is all one command):

dsquery group "CN=OldGroup,OU=MyUsers,DC=MyAD,DC=local" | dsget group -members | dsmod group "CN=NewGroup,OU=MyUsers,DC=MyAD,DC=local" -addmbr

A similar scenario is documented in the help for
dsmod group /?
where it shows adding all the users from an OU into a group.

0
 
karstiemanCommented:
You'll have to write a export script to export all users from the group.
There's no way to copy unless you copy the entire group you want to delete now and add this as member to your new group.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.