$User = "user1@domain.com"
$UserAddingGroups = "user2@domain.com"
Get-ADUser -LDAPFilter "(&(UserPrincipalName=$User))" -Properties * | Select-Object MemberOf |
ForEach-Object { $_.MemberOf | Add-ADGroupMember -Identity $_.MemberOf -Members $UserAddingGroups -Confirm:$true }
Get-ADUser -LDAPFilter "(&(UserPrincipalName=$user))" -Properties * | Select-Object MemberOf |
ForEach-Object { $_.MemberOf | Format-Table }
Active Directory (AD) is a Microsoft brand for identity-related capabilities. In the on-premises world, Windows Server AD provides a set of identity capabilities and services, and is hugely popular (88% of Fortune 1000 and 95% of enterprises use AD). This topic includes all things Active Directory including DNS, Group Policy, DFS, troubleshooting, ADFS, and all other topics under the Microsoft AD and identity umbrella.
TRUSTED BY