In this article, I will explain How to
Get all groups that a user is a member of using PowerShell
Sometimes, you might need to get the Active Directory groups in which a user is a member of. specifically, if you didn’t have access permission to Active Directory server where you don’t have a GUI to go to user properties and checks the “Member Of” tab.
In this case, you only have an option to get the Active Directory groups in which a user is a member via PowerShell. by doing the following:
- Run Command Prompt / Windows Power-Shell as administrator.
- Run the below cmdlet.
net user /domain username
- In my scenario, I need to know if the “spepmfarm” belongs to “epmsys” group or not.
net user /domain spepmfarm
- Check Global Group Membership line to find all groups in that a user “spepmfarm” is a member of.
You could also find other useful details like (last login, last password set and more).
Get all AD Groups in that a user a member of
You can also use “Get-ADPrincipalGroupMembership” to get the AD group list that a user is a member of
Get-ADPrincipalGroupMembership username_withoutdomain | select name
- Windows Server.