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)
}

Comments

Popular posts from this blog

SCCM Software Distribution Troubleshooting

Powershell - List AD Organizational Unit and GPOs linked to them

Troubleshooting System Center Endpoint Protection (SCEP) Client