How to get list of all AD users in AD group
To list all members of one AD security group:
Get-AdGroupMember -identity "Domain Admins" | get-aduser -Properties * | ft name, samaccountname, whencreated
To list all sec. groups of one AD user (member of what groups):
Get-ADUser -Identity [someone'-samaccountname] -Properties memberof|Select-Object -ExpandProperty memberof
To copy all groups from one AD user to other:
Get-ADUser -Identity [source-user-samaccountname] -Properties memberof|Select-Object -ExpandProperty memberof|Add-ADGroupMember -Members [target-user-samaccountname]
# all groups of [source-user-samaccountname] will be copied to [target-user-samaccountname]… Read the rest