# Get ActiveDirectory  groups for user

**URL:** <https://forums.powershell.org/t/get-activedirectory-groups-for-user/357>\
**Category:** PowerShell Help\
**Created:** [December 31, 2011, 6:30pm UTC](https://forums.powershell.org/t/get-activedirectory-groups-for-user/357 "2011-12-31T18:30:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![archives](https://avatars.discourse-cdn.com/v4/letter/a/bb73d2/32.png) [@archives](https://forums.powershell.org/u/archives)\
**Post date:** [December 31, 2011, 6:30pm UTC](https://forums.powershell.org/t/get-activedirectory-groups-for-user/357/1 "2011-12-31T18:30:00Z")

</div>

by GeorginaHowland at 2012-11-22 08:55:24

> New to powershell  
> I would like to query active directory to get memberof however should only display CN=  
> what I am currently typing  
>   
> Get-Aduser USERNAME -property memberof  
>   
> MemberOf : {CN=ITIM\_PW\_Team\_Members,OU=Groups,OU=IT Services,DC=internal,DC=Heritage,DC=ca, CN=HO\_IT\_Serv  
> roups,OU=Head Office,DC=internal,DC=Heritage,DC=ca, CN=CBS\_Equipment\_Disposal\_R,OU=Groups,OU=H  
> e,DC=internal,DC=Heritage,DC=ca, CN=TWGAdmins,OU=Groups,OU=Head Office,DC=internal,DC=Heritage  
>   
> would like to display  
>   
> memberof  
> CN=ITIM\_PW\_Team\_Members  
> CN=HO\_IT\_Services  
> CN=CBS\_Equipment\_Disposal\_R

by DonJ at 2012-11-23 12:18:22

> You’re going to have to enumerate the MemberOf collection. If it’s just strings, which I suspect it is, you’ll have to parse those strings out yourself. Kind of a pain, actually.

by GeorginaHowland at 2012-11-27 08:17:03

> Thank you

by mikefrobbins at 2012-11-27 09:18:52

> `(Get-Aduser USERNAME -property memberof).memberof -replace ",."`  
> _or_  
>   
> _`(Get-Aduser USERNAME -property memberof | select -expand memberof) -replace ",.`_`"`

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:57pm UTC](https://forums.powershell.org/t/get-activedirectory-groups-for-user/357/2 "2024-05-16T20:57:50Z")

</div>


