Get ActiveDirectory groups for user

Welcome Forums General PowerShell Q&A Get ActiveDirectory groups for user

This topic contains 0 replies, has 1 voice, and was last updated by  Forums Archives 7 years, 2 months ago.

  • Author
  • #5302

    Points: 0
    Rank: Member

    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


    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 "\,.*"

    (Get-Aduser USERNAME -property memberof | select -expand memberof) -replace "\,.*"

The topic ‘Get ActiveDirectory groups for user’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort