Thursday, July 25, 2013

Active Directory - Find Difference Between Group Membership For User

While getting access transferred from one user to another, you may need to know how the group memberships are different between two users.
Import-Module ActiveDirectory

$leaving = Get-ADUser -Identity John.Doe -Properties memberof | select -expand memberof
$promoted = Get-ADUser -Identity Michael.West -Properties memberof | select -expand memberof

Compare-Object -ReferenceObject $promoted -DifferenceObject $leaving

1 comment:

  1. Nice PowerShell posts you got there, keep the good work! :-)

    I see that you were one of the competitor during scripting games 2013! Nice!

    http://lazywinadmin.com

    ReplyDelete