Hi,
 
I believe the simplest solution is this:
 
Get-ADGroupMember -Identity <SourceGroup> | Add-ADPrincipalGroupMembership 
-MemberOf <TargetGroupName>

You'll see reference to that second cmdlet in the help for Add-ADGroupMember
 
Best wishes,
 
Andrew
 
http://cantoriscomputing.wordpress.com/
From: jmar...@babc.com
To: scripting@lists.myitforum.com
Subject: [scripting] RE: Copy all AD Group Members to Another Group
Date: Tue, 22 Jul 2014 14:59:30 +0000









thanks. That's what I was looking for.



The other post using the Quest tools works too but I wanted to do it without 
using Quest.
 


From: listsad...@lists.myitforum.com [mailto:listsad...@lists.myitforum.com]
On Behalf Of Mathieu Kindelberger

Sent: Tuesday, July 22, 2014 9:54 AM

To: scripting@lists.myitforum.com

Subject: [scripting] RE: Copy all AD Group Members to Another Group


 
Hi John, 
You can use this command :
Get-ADGroup
GroupA -properties members |
foreach {Add-ADGroupMember -id
GroupB
-MEMBERS ($_.Members)
 }
Best regards
 


From: 
listsad...@lists.myitforum.com [mailto:listsad...@lists.myitforum.com]
On Behalf Of Marcum, John

Sent: mardi 22 juillet 2014 16:33

To: Scripting List (scripting@lists.myITforum.com)

Subject: [scripting] Copy all AD Group Members to Another Group


 
I'm sure this is really easy but…. I need to copy all of the users in Group A 
to Group B with PoSh. How do I do that?
 
I see that Get-ADGroup
GroupA
-properties
members
gets me all the members and
Add-ADGroupMember
-Identity
GroupB
would be used to add the members into the second group.
How do I pipe the members out and in?
 
 
 
 









        John Marcum
            MCITP, MCTS, MCSA

              Desktop Architect
   Bradley Arant Boult Cummings LLP













      
 
 





Confidentiality Notice: This e-mail is from a law firm and may be protected by 
the attorney-client or work product privileges. If you have received this 
message in error, please notify the sender by replying to this e-mail and then 
delete it from your computer.
 
 





Confidentiality Notice: This e-mail is from a law firm and may be protected by 
the attorney-client or work product privileges. If you have received this 
message in error, please notify the sender by replying to this e-mail and then 
delete it from your computer.






Confidentiality Notice: This e-mail is from a law firm and may be protected by 
the attorney-client or work product privileges. If you have received this 
message in error, please notify the sender by replying to this e-mail and then 
delete it from your computer.








                                          


Reply via email to