Hi,
I have this so far but its obviously incorrect somewhere. Basically I need to export user groups of one user into a variable then add them to another user
Thanks
Import-Module ActiveDirectory
$SourceUser = Read-Host "Enter source username"
$DestinationUser = Read-Host "Enter destination username"
$cmd = Get-ADPrincipalGroupMembership -Identity $SourceUser
foreach ($Person in $cmd) {
Add-ADGroupMember -Identity $DestinationUser -Members $Person.distinguishedname
}