Vai al contenuto

Copy Active Directory Group Member from an user to another

Link di riferimento:

https://github.com/carlhillit/YouTube/tree/main/Copy-ADGroupMembership

Login on your Active Directory via RDP;
open a text editor e paste the code below

# Gets User information including the MemberOf property
$ReferenceUser = Get-ADUser -Identity michelle.adams -Properties MemberOf

# Isolate the groups
$SelectedGroups = $ReferenceUser.MemberOf

# Adds TargetUser to groups
$SelectedGroups | Add-ADGroupMember -Members paul.allen

Replace michelle.adams with the account name from which you want to copy the associated groups and replace paul.allen with the account name on which you want to apply the copied groups

Once the changes are complete save the file with the extension .ps1

Now we need to open a Powershell window with administrative rights, place ourselves as the path there where we saved the file with the extension .ps1 and finally run the powershell script

Lascia un commento

Il tuo indirizzo email non sarĂ  pubblicato. I campi obbligatori sono contrassegnati *