MS Windows – List Groups a user belongs to

Background

Let us use built-in tools to review our Active Directory group memberships.

Outline

  1. whoami
    • whoami /groups
  2. dsquery
    • dsquery | dsget

Machine

whoami

whoami – List Local Groups

Script

whoami /groups /fo csv | find /V "%USERDOMAIN%\" | more

Output

whoami – List Domain Groups

Script

whoami /groups /fo csv | find "%USERDOMAIN%\" | more

 

Domain

dsquery

dsquery | dsget

Script

dsquery user -samid %username% | dsget user -memberof

Output

dsquery_dsget_20170929_0400pm.png

References

  1. whoami
    • Command Line Reference
      Link
    • John Savill
      • How can I determine which groups I’m a member of for my current logon session?
        Link
  2. dsquery // dsget
    • ss64.com
      • DSQuery user (installable option either via RSAT /AD DS or adminpack.msi)
        Link
      • StackExchange
        • superuser.com
          • Using the “net user” command in Windows XP to list all group memberships for a specific Active Directory user
            Link

Leave a Reply

Please log in using one of these methods to post your comment:

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 )

Connecting to %s