The goal of this script is to grant the destination user all the missing memberships when compared to the source user. Any missing memberships will be added by this script and and any additional memberships will be removed. The script will prompt for both adding the user to the groups as well as removing the user from groups. Because of this behaviour it is possible to only add or only remove groups from a user.

This script is an evolution of my previous script, the 'Compare group membership of two users and add target user to; script which can be found here: groups http://gallery.technet.microsoft.com/Compare-group-membership-36dfa920

 

Version 1.0

 

Version 1.1

 

PowerShell
Edit|Remove
<#    
.SYNOPSIS    
    Script that compares group membership of source user to destination user, changes destination user group membership 
     
.DESCRIPTION  
    This script compares the group membership of $SourceAccount and $DestinationAccount, based on the membership of the 
    source account the destination account is also added to these groups. Script outputs actions taken to the prompt. 
    The script can also run without any parameters then the script will prompt for both usernames. The GUI is intended 
    to simplify this process and to give a better overview of the action the script intends to perform. 
  
.PARAMETER SourceAccount 
    User of which group membership is read 
 
.PARAMETER DestinationAccount 
    User of which group membership will be changed by comparing it to source user 
 
.PARAMETER ComputerName 
    The netbios name or FQDN of the domain controller which will be queried for the respective users 
 
.NOTES    
    Name: Compare-ADuserAddGroupGUI.ps1 
    Author: Jaap Brasser 
    DateCreated: 2015-03-10 
    Version: 1.1 
    Blog: www.jaapbrasser.com 
 
.EXAMPLE    
    .\Compare-ADuserAddGroupGUI.ps1 testuserabc123 testuserabc456 
 
Description  
-----------      
This command will add&remove from groups testuserabc456 to match groups that testuserabc123 is a member of the user is 
prompted by user interface to confirm these changes. 
 
.EXAMPLE    
    .\Compare-ADuserAddGroupGUI.ps1 
 
Description  
-----------      
Will use GUI to prompt for confirmation  
#>