Solved

Compare group membership from two AD accounts with Powershell

Posted on 2014-04-10
4
4,500 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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Resolve DNS query failed errors for Exchange
A brief introduction to what I consider to be the best editor for PowerShell.
This tutorial will give a an overview on how to deploy remote agents in Backup Exec 2012 to new servers. Click on the Backup Exec button in the upper left corner. From here, are global settings for the application such as connecting to a remote Back…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

895 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

12 Experts available now in Live!

Get 1:1 Help Now