Search code examples
windowspowershellcmdactive-directorypowershell-2.0

How to get all groups that a user is a member of?


PowerShell's Get-ADGroupMember cmdlet returns members of a specific group. Is there a cmdlet or property to get all the groups that a particular user is a member of?


Solution

  • Get-ADPrincipalGroupMembership from the Active Directory module will do this. You'll need that module, or RSAT on Windows 10+, installed to run the command below.

    Get-ADPrincipalGroupMembership username | select name
    
    name
    ----
    Domain Users
    Domain Computers
    Workstation Admins
    Company Users
    Company Developers
    AutomatedProcessingTeam