PowerShell : List all active users and their group membership in a domain

So you need to know which users are members of which group… this little PowerShell Script will do the job.

  • Open Notepad and paste the code in below. Save it with the file extension ps1.
  • Open PowerShell with administrator rights.
  • Run the following command the allow unsigned scripts to run locally.

Full Documentation here.

Now run the file that you created above, ensure you have a folder on the root of the C: drive called tmp or change the script to your own folder.

It will spit out an CSV file which can be opened in Excel.

 

One Reply to “PowerShell : List all active users and their group membership in a domain”

  1. Is it possible for this script to display just the name and then each group on the same row in different cells ?

    Joe blogs | Group 1 | Group 2 | Group 3

    Also is it possible to only show groups that begin with a certain letter?

    Many Thanks and great work.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.