Copy Group membership (security and distribution) from one user to another
Hello,
I'm fairely new to this forum and exchange/ad adminstration, but i wanted to know if there was a way to copy the membership attribute on AD for one user and apply it to another.
Please advise the script or cmdlet i need to run
August 23rd, 2011 12:00pm
Hi,
You can export DL members first then import it with new DL.
1:
http://www.ucblogs.net/blogs/exchange/archive/2008/07/03/Exporting-distribution-list-membership-to-Excel.aspx
http://social.technet.microsoft.com/Forums/en-US/exchangesvradmin/thread/63ad55d1-1393-4533-8065-1d7cbd8657fa/
Import and create:
http://www.powershellcommunity.org/Forums/tabid/54/aft/4721/Default.aspx
Create a DG:
new-distributiongroup -alias Contoso -name "Contoso People" -type distribution -organizationalunit "Mail distribution groups" -samaccountname Contoso
Add Users to this DG from a OU:
get-user -organizationalunit people | get-mailbox | %{ add-distributiongroupmember -identity Contoso -member $_}
Anil MCC 2011,ITIL V3,MCSA 2003,MCTS 2010, My Blog : http://messagingschool.wordpress.com
Free Windows Admin Tool Kit Click here and download it now
August 23rd, 2011 12:42pm
I'm not looking to export all of the DL members. What I am trying to do is, John started in our company two weeks ago and would like to have the same security and distribution membership as Alex. Alex is a member of about 40 groups, so manually adding
John to each group is a pain.
Is there a way to copy Alex's membership and apply it to John?
August 23rd, 2011 1:57pm
At the time of provisioning yes, you'll need to copy Alex's account. After that, you'll need some VB Scripts to do the job. You could also try Quest's activeserveroles and other tools for powershell. They add a "memberof" command that can do
half of what you're looking for
http://www.quest.com/powershell/activeroles-server.aspx
Free Windows Admin Tool Kit Click here and download it now
August 23rd, 2011 2:26pm
Hi senai,
Please save the below txt as a .ps1 file(e.g. c:\a.ps1)
$user1 = [ADSI]LDAP://CN=from,OU=Test,DC=Contoso,DC=com
$user2 = [ADSI]LDAP://CN=to,OU=Test,DC=Contoso,DC=com
foreach ($group in $user1.memberof)
{
$group = [ADSI]LDAP://$group
$DN = $user2.distinguishedName
$group.Add(LDAP://$DN)
}
Navigate to C:\> in the EMS, after that, run the ps1 file.
C:\>.\a.ps1
Frank Wang
August 25th, 2011 3:09am
Hi senai,
Any updates?
Frank Wang
Free Windows Admin Tool Kit Click here and download it now
August 28th, 2011 9:41pm