List AD group members in PowerShell

Here’s how to list AD group members in PowerShell:

PS C:\Users\Vorkbaard> Get-ADGroupMember "ALLOW USB DATA" -Recursive | select name | Sort-Object name

Breakdown:
Get-ADGroupMember gets all group members. My group is called ‘ALLOW USB DATA’ (it is connected to a group policy that allows or denies users data access to usb devices based on this group membership).
-Recursive lists nested group members instead of nested group names.
select name prints just the name, no other information like SID and objectClass.
Sort-Object name sorts by ‘name’

Leave a Reply

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

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