How to get the List of AD Groups that a user is member of using PowerShell?

Assume that you have a userid which is part of Active Directory and you would like to get the list of all the active directory groups in which the specified user is a member of. You can do this easily using Powershell.

How to get the List of AD Groups that a user is member of using PowerShell?

Here’s a Powershell code snippet demonstrating how to do it. Replace the <userName> with the username that you want find the groups for which the username is member of.

Import-Module ActiveDirectory

(Get-ADUser <userName> –Properties MemberOf | Select-Object MemberOf).MemberOf

Pin It

Leave a Reply

Your email address will not be published. Required fields are marked *