Get Groups in which a user is a member Using PowerShell

In this article, I will explain How to

Get all groups that a user is a member of using PowerShell


Scenario

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.

Get all groups that a user is a member of using PowerShell

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:

Steps

  • Run Command Prompt / Windows Power-Shell as administrator.

Run CMD 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 the Active Directory groups in which a user is a member via PowerShell


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

Get all AD Groups in that a user a member of


Applies To
  • Windows Server.
Advertisements

One thought on “Get Groups in which a user is a member Using PowerShell

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s