Updated: Mar 17, 2019
User Nightingal on the MS Technet Forum needed help with a PowerShell script to sync Security Group A to Security Group B.
The best way I could think of is to compare the two security groups and sync the users to Security Group B.
I built a function to compare the two security groups actions of SYNC, ADD, REMOVE, TEST. I have also added a few error checking, like BREAK if Security Group A is missing. Alternatively, create Security Group B in the same OU as Security Group A if missing.
Here is the code:
As always you can find the code at my GitHub Repo Sync-ADGroup.ps1.
Code Modded for u/SoapCobra on Reddit
u/SoapCobra requested for a pop up box for users to enter information.
After function is loaded just run the below command:
A pop-up input box will ask for Source Group once entered. A new pop input box will ask for Destination Group. One the groups are entered the code syncs the groups.