PowerShell - Copy AD Group membership
#Copy group membership from source group to target group
Import-Module ActiveDirectory
$gsource =Get-ADGroup "Test Group1"
$gtarget = Get-ADGroup "Test Group2"
Get-ADGroupMember -Identity $gsource |
foreach {
Add-ADGroupMember -Identity $gtarget -Members $($_.DistinguishedName)
}
Import-Module ActiveDirectory
$gsource =Get-ADGroup "Test Group1"
$gtarget = Get-ADGroup "Test Group2"
Get-ADGroupMember -Identity $gsource |
foreach {
Add-ADGroupMember -Identity $gtarget -Members $($_.DistinguishedName)
}
Comments
Post a Comment