Copy Group Members

  • 16 September 2016
  • Sean Huggans
Description: 

Copy members of a source Active Directory group to a target group.

Language: 
PowerShell
###############################
# CopyGroupMembers.ps1
# Script by Sean Huggans
# Original Date: 2016.09.15
###############################
 
import-module ActiveDirectory
 
$SourceGroup = "MyTestGroup"
$TargetGroup = "MySecondTestGroup"
 
foreach ($Member in $(Get-ADGroupMember -Identity $SourceGroup)) {
echo $Member
Add-ADGroupMember $TargetGroup $Member.distinguishedName
}
Note: that all applications posted here are posted for use, both commercial and non-commercial, free of charge, and as such are provided without warranty of any kind whatsoever. FMSCUG or any program's author are not responsible for any damages or shortcomings that result from usage of any of these applications.