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

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

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...
In this post, let’s learn about the Powershell error “The file <Filename> is not digitally signed. You cannot run this...
There are many ways in which you can run your PowerShell Script. In this post , we will how to...