Sometimes you may find that you need to export the list of which security and distribution groups a user belongs to into a text file. This is sometimes done for auditing purposes and sometimes required because that amount of text in a CMD prompt is just oo hard to navigate.

Easy way to ouput what user a group belongs to into a text file

As you can see in the screenshot above, we are using the whoami command, but you can also use net user as we explain here.

  • whoami returns the current username
  • whoami /groups returns a complete list of all groups that user belongs to
  • whoami /groups > c:\temp\test1.txt creates a file that contains all of the groups the user belongs to


0 Comments

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *