One common request I see is getting a list of users that belong to an Active Directory security group. This is requested for various reasons such as, supervisor wants to know who has access to a folder, auditor wants a list of users, 3rd party program or cloud service needs to import a list of users from a csv file.

The problem is…

The built in Active Directory users and Computer tool has no option to export members from a group.

To accomplish this we can use PowerShell.

In this tutorial, I will walk through the steps for exporting group members to a csv file.

Let’s get started.

Step 1: Load the Active Directory Module

To connect and query an AD group with PowerShell the Active Directory module needs to be loaded.

The Active Directory module can be installed with the following methods:

  • Having RSAT tools installed
  • Windows Server 208 R2 and above with the AD DS or AD LDS server roles

You can run the following command to see if you have installed

Get-Module -Listavailable

As you can see I don’t have the module installed.

If you already have the module loaded then jump to step 2, if not following these instructions.

To get the Active Directory module installed on my Windows 10 PC, I will need to download and install the RSAT tools.

With the RSAT tools installed, I run the Get-Module -ListAvailable command again

Now I have the module installed, let’s move on to step 2.

RELATED: Tutorial on how to install PowerShell modules

Step 2: Find AD Group

If you already know the name of the group, then skip to step 3.

If you’re not sure what the group name is, you can issue the following command to list all Active Directory groups.

get-adgroup -filter * | sort name | select Name

Above, is a screenshot of some of the groups listed in my domain. I had an HR group but wasn’t sure of its complete name, I can see it’s HR full. I’ll use that group in step 3 to list out the members.

Step 3: Use Get-AdGroupMember to list members

The following command will list all members of my HR Full group

Get-AdGroupMember -identity HR Full

You can see the above command provides more details on the group members than I need.

We can filter out the results and just get the member name with this command

Get-AdGroupMember -identity “HR Full” | select name

Perfect, now I just need to export this to csv.

Related: How to export all Users from Active Directory

Step 4: Export group members to csv file

The last step is to export the results to a scv file

This is done by adding Export-csv to our above commands. The full command looks like this

Get-ADGroupMember -identity “HR Full” | select name | Export-csv -path C:OutputGroupmembers.csv -NoTypeInformation

Now I have a csv file of all the members from the HR Full Active Directory group.

Pretty easy right?

Method 2: Group Membership Report Tool

I created a GUI tool that makes it easy for anyone to export groups and group membership to CSV or HTML. 


This GUI tool is a great alternative for anyone that doesn’t want to spend the time creating PowerShell scripts to export groups and group membership. This tool is built with PowerShell so if you wanted to look at the code or make changes you are free to do so. 

Download Your Copy of Group Membership Report Tool

Recommended Tool: SolarWinds Server & Application Monitor

This utility was designed to Monitor Active Directory and other critical services like DNS & DHCP. It will quickly spot domain controller issues, prevent replication failures, track failed logon attempts and much more.

What I like best about SAM is it’s easy to use dashboard and alerting features. It also has the ability to monitor virtual machines and storage.

Download Your Free Trial Here


  1. Richard on May 11, 2018 at 3:51 pm

    I’m looking for a similar script to export to csv groups and members within groups:

    • Robert Allen on June 26, 2018 at 1:06 pm

      Hi Richard,

      Just add -Recursive at the end to include members of child groups


      Get-AdGroupMember -identity HR Full -Recursive

      • Jayan Patel on August 27, 2019 at 3:53 pm

        Hi Robert,

        What if i have to get entire (All) groups in one excel?

        instead of a specific group, I need to have all my groups with their current users in it.

        • Robert Allen on September 7, 2019 at 8:21 pm

          I have a GUI tool for that

          To do this in PowerShell you would use Get-ADGroup to get all groups and set them to a variable. Then use a for each loop to loop through each group and run get-adgroupmember on each group.

      • Abhishek Dhar on June 24, 2020 at 6:19 am

        Is it possible to add users from a CSV to a AD group

  2. Chris on May 15, 2018 at 6:57 pm

    Very helpful, thanks!

    • Robert Allen on May 15, 2018 at 11:12 pm

      No problem.

    • Scott on March 21, 2019 at 8:15 pm

      As many others have said, very helpful Robert, thank you!

  3. Jay on May 25, 2018 at 7:52 pm

    Exactly what I needed. Thanks for the information in easily and quickly digestible format!

    • Robert Allen on May 26, 2018 at 12:14 pm

      No problem Jay.

  4. Yulia on May 28, 2018 at 12:42 pm

    Hello, Thank you for the post. But I get an error on Step 2: “get-adgroup : Unable to find a default server with Active Directory Web Services running.”

    • Robert Allen on May 28, 2018 at 10:04 pm


      The Powershell Active Directory module uses AD Web services to manage and administer Active Directory. You will need to make sure your server is running AD web services. What version of server are you running?

  5. Manny on May 30, 2018 at 7:37 pm

    What is the powershell command to export AD “Contacts” members of an AD group?

    • Robert Allen on June 26, 2018 at 12:59 pm

      Hi, Manny

      This command will list both contacts and users of an AD group.

      Get-ADGroup group-name -Properties member | select-object -ExpandProperty member

      • z on August 28, 2018 at 9:26 pm

        Thanks big help

      • Enzi on July 16, 2019 at 2:13 pm

        Hi Robert,

        Such a time saver! When I try to export this to a csv it doesn’t work.
        I usually add | Export-csv -path filepath\filepath\file.csv

        Any ideas?

        • Robert Allen on July 17, 2019 at 1:00 pm

          Enzi, did you try it with a drive letter? | export-csv -path c:\filepath\file.csv

  6. Edward Ramz on May 31, 2018 at 5:40 pm

    Thank you! amazing, thank you for your time and sharing the info thanks!!!

    • Robert Allen on June 3, 2018 at 12:30 pm

      No problem Edward.

  7. Tamu Taylor on June 18, 2018 at 4:20 pm

    Thank you!

    • Robert Allen on June 20, 2018 at 12:00 pm


      You’re welcome

  8. me on June 25, 2018 at 2:58 am

    good article, clear and EZ to use,
    thank you.

    • Robert Allen on June 28, 2018 at 12:15 am

      You’re Welcome!

  9. Richard on June 27, 2018 at 2:21 pm

    WOW this is well put together. Thanks.

    • Robert Allen on June 28, 2018 at 12:15 am


      No problem.

  10. Roger on July 18, 2018 at 2:39 pm

    Awesome Thanks!

    • Robert Allen on July 19, 2018 at 11:35 am

      No problem, I hope you find it useful.

  11. Senthil R (IBM India) on July 22, 2018 at 7:16 pm

    really informative and useful commands for AD admins

  12. Te'a Lutau on July 24, 2018 at 8:53 pm

    Awesome Article!

    • Robert Allen on August 12, 2018 at 12:11 am

      Thanks Latau

  13. Guan on August 15, 2018 at 12:30 am

    This worked great!

    Amy chance we can add last logon date? Other scripts I tried from the web did not work.

  14. Bobby on August 28, 2018 at 2:15 pm

    This is awesome! Do you know how to also get users email address?

    • Robert Allen on August 31, 2018 at 1:02 pm

      Here is an example that will list users name and email of a group

      Get-ADGroupMember -Identity HR-N-Drive-RW -Recursive | Get-ADUser -Properties Mail | Sel
      ect-Object Name, Mail

      • in need of help on June 6, 2019 at 8:19 am

        I LOVE YOU MAN

  15. Nathan on August 30, 2018 at 11:00 pm

    Can you export samaccountname and name together? I tried it in various ways, but can only seem to do one or the other.

    • Robert Allen on August 31, 2018 at 1:03 pm

      Here you go

      Get-ADGroupMember -Identity HR-N-Drive-RW -Recursive | Get-ADUser | Select-Object Name,

      • Geekgal on March 12, 2020 at 5:37 pm

        THANK YOU! I really needed the emails listed as well.

  16. Kumar on October 19, 2018 at 7:52 am

    thanks for good share , easy to understand and quick

  17. Papi on October 19, 2018 at 2:37 pm

    Truly appreciate this, best explanation and clear instructions

  18. Vicky on November 29, 2018 at 12:51 pm

    Thanks for this 🙂

    • Robert Allen on November 29, 2018 at 1:05 pm

      No problem

  19. Dustin on February 13, 2019 at 3:23 pm

    Amazing how simple you made this! thanks!!

  20. John B on March 8, 2019 at 2:07 pm

    This was perfect. Thank you!

  21. Paul on March 20, 2019 at 2:39 pm

    Wow this is great. clear tutorial and easy to follow. Works exactly as I had hope. Thank you Robert!!!

  22. Thomas K on March 25, 2019 at 10:32 am

    Thanks for this, turned a slog of a job into a 5 min breeze! 🙂

  23. Alberto Bigio on March 26, 2019 at 3:21 pm

    Very Useful. Thanks

  24. Kristi on April 5, 2019 at 2:20 pm

    This helped so much. Thank you!!!

  25. Ali on May 16, 2019 at 12:22 pm

    Thanks !

  26. Yuvaraj on May 22, 2019 at 7:09 am

    Thank you so much for this! As a beginner, I wanted a quick way of getting the list of users from a specific group. I searched it for weeks and finally found this post! . With these commands, lot of hours will be saved.

  27. Kiran Muthyala on May 23, 2019 at 2:21 pm

    Thanks , this worked

  28. Alan L on May 29, 2019 at 2:02 pm

    very interesting/handy…
    I have a range of AD groups I want to list (eg all AD groups starting g_abcCouncil) how would I modify the filter command ?

    (I tried -filter g_abcCouncil* but got a parsing error, not supported)

    • Robert Allen on May 29, 2019 at 10:27 pm

      You want to list just the groups and sort them or the groups and members? This would get all groups and sort them get-adgroup -filter* | sort

  29. Raj on June 6, 2019 at 8:47 pm

    It was really useful. Thank you. Is there a possibility to add First name and Last name in the output from the AD group

    • Robert Allen on June 7, 2019 at 11:49 am

      Raj, my AD User Export Tool includes first and last name and several other user properties. It can be customized to export exactly what you need.

  30. Sachin on July 5, 2019 at 11:26 am

    Exactly What I needed. Thank You!

  31. Dave Murdoch on July 16, 2019 at 1:12 pm

    Clear and concise…thank you!

    • Robert Allen on July 17, 2019 at 12:58 pm

      No problem 🙂

  32. Rahul Kashyap on August 9, 2019 at 2:46 pm

    This is Awesome.. Helped me a lot.

    I have two quick questions:
    1. How can I see Group name and Member name as output?
    2. How can I choose multiple groups?

    Thanks in advance.

  33. Abby on August 28, 2019 at 3:37 pm

    Very Helpful. Thanks for sharing.

  34. Simon on October 9, 2019 at 1:09 pm

    This is excellent! Simple to follow. That’s how I like it. Cheers.

  35. Vince on October 20, 2019 at 4:30 am

    VERY informative.

    Thank you, Robert!

  36. Zo on October 23, 2019 at 8:59 pm

    It worked! Thanks for the help! Great page with great examples.

    • Robert Allen on October 26, 2019 at 1:32 pm

      Zo, you are welcome.

  37. Stefan on October 25, 2019 at 1:40 pm

    Thanks !

    • Robert Allen on October 26, 2019 at 1:31 pm

      No problem

  38. Chi on November 1, 2019 at 8:39 pm

    Hi Robert,
    Thank you for your post. How do I export group members from a specific domain. When I ran the Get-AdGroupMember command, it gets it from a different domain.

  39. Jack on November 7, 2019 at 10:49 pm

    How would you filter down to a specific string in the Active Directory Domain Services Folder?

    • Robert Allen on November 10, 2019 at 3:17 pm

      Not sure, what exactly are you trying to accomplish?

  40. P.G on November 28, 2019 at 12:08 pm

    Very helpful tutorial. Thank you very much…

  41. Paul on May 28, 2020 at 6:10 pm

    Just one word – AWESOME!!

    • Robert Allen on May 31, 2020 at 8:25 pm

      Thanks for the feedback Paul

Leave a Comment