Solved

Compare group membership from two AD accounts with Powershell

Posted on 2014-04-10
4
4,326 Views
Last Modified: 2014-04-10
Hi EE

Anyone have a script that will compare the group membership from two accounts in active directory ?

Compare account A from account B and tell me the groups missing from account A
0
Comment
Question by:MilesLogan
  • 2
  • 2
4 Comments
 
LVL 9

Expert Comment

by:Sean
ID: 39991682
$a= Get-ADGroupMember GroupA
$a | Select name

$b = Get-ADGroupMember GroupB
$b| Select name

compare-object $a $b

You could easily turn this into a script.
0
 
LVL 2

Author Comment

by:MilesLogan
ID: 39991695
Hi Zindel1 .. I am needing to compare two accounts .. not groups ..
0
 
LVL 9

Accepted Solution

by:
Sean earned 500 total points
ID: 39991730
Sorry - will still be the same idea only use Get-ADPrincipalGroupMembership in place of Get-ADGroupMember

so -

$a = Get-ADPrincipalGroupMembership -Identity Username
$b = Get-ADPrincipalGroupMembership -Identity Username
compare $a $b
0
 
LVL 2

Author Closing Comment

by:MilesLogan
ID: 39991804
Zindel1 thanks !!
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Join & Write a Comment

New Windows 7 Installations take days for Windows-Updates to show up and install. This can easily be fixed. I have finally decided to write an article because this seems to get asked several times a day lately. This Article and the Links apply to…
Possible fixes for Windows 7 and Windows Server 2008 updating problem. Solutions mentioned are from Microsoft themselves. I started a case with them from our Microsoft Silver Partner option to open a case and get direct support from Microsoft. If s…
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles to another domain controller. Log onto the new domain controller with a user account t…
This tutorial will show how to configure a single USB drive with a separate folder for each day of the week. This will allow each of the backups to be kept separate preventing the previous day’s backup from being overwritten. The USB drive must be s…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now