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

Leave A Reply

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

You May Also Like

Are you looking at importing DscResource with Relative Paths when working in PowerShell? If so, let’s have a look at...
If you are new to PowerShell and wondering how to add comments with-in your Powershell code , here’s how you...
If you want to find the version of the PowerShell that is installed on the PC , you can use...