?
Solved

Compare group membership from two AD accounts with Powershell

Posted on 2014-04-10
4
Medium Priority
?
5,680 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 12

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 12

Accepted Solution

by:
Sean earned 2000 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Compliance and data security require steps be taken to prevent unauthorized users from copying data.  Here's one method to prevent data theft via USB drives (and writable optical media).
In this post, I will showcase the steps for how to create groups in Office 365. Office 365 groups allow for ease of flexibility and collaboration between staff members.
This tutorial will walk an individual through the steps necessary to install and configure the Windows Server Backup Utility. Directly connect an external storage device such as a USB drive, or CD\DVD burner: If the device is a USB drive, ensure i…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…

807 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