How to get Active Directory group members using Get-ADGroupMember

Retrieving Active Directory group members

Get-ADGroupMember is a PowerShell cmdlet used to retrieve the members of an Active Directory group, including users, computers, and other groups. This command is essential for IT administrators managing group memberships, auditing security permissions, and ensuring proper access control across an organization's Active Directory environment.

While Get-ADGroupMember provides a straightforward way to list group members, it requires scripting knowledge and can become complex when dealing with nested groups or large environments. Additionally, retrieving Microsoft Entra ID group members requires a different approach, such as using Microsoft Graph PowerShell, which comes with its own challenges like throttling limits and authentication complexities.

For a more efficient and user-friendly solution, ManageEngine ADManager Plus offers an intuitive, no-code interface to retrieve and manage group memberships effortlessly. With pre-built reports and automation capabilities, administrators can streamline group management without the need for PowerShell scripting.

  • ADManager Plus
  • PowerShell
 

Get Active Directory group members using ADManager Plus

  1. Log in to ADManager Plus.
  2. Go to Reports > Group Reports > Member-based Reports > Group Members.
  3. Select the domain and the groups you want to retrieve the membership details of.
  4. Click Generate to get the report.
Get Active Directory group members using ADManager Plus' comprehensive reports.
 
 

Export reports in various formats, like PDF, XLS, CSV, and HTML.

 
 

Perform on-the-fly management actions on the objects generated via the report.

 
 

Set up automated report generation.

Get Active Directory group members using PowerShell

Prerequisites

Before running the Get-ADGroupMember cmdlet, ensure the following requirements are met:

  • The Active Directory module for Windows PowerShell is installed. If it's not installed, run:
    Install-WindowsFeature -Name RSAT-AD-PowerShell
  • Import the Active Directory module if it's not already loaded:
    Import-Module ActiveDirectory

Using the Get-ADGroupMember cmdlet to get Active Directory group members

Use the Get-ADGroupMember cmdlet to get Active Directory group members. The syntax is as follows:

Get-ADGroupMember
[-AuthType <ADAuthType>]
[-Credential <PSCredential>]
[-Identity] <ADGroup>
[-Partition <String>]
[-Recursive]
[-Server <String>]
[<CommonParameters>]

Example use cases and scripts using the Get-ADGroupMember cmdlet

Example 1: Get all members of a group

Get-ADGroupMember
cmdlet Get-ADGroupMember at command pipeline position 1
Supply values for the following parameters: (Type !? for Help.)
Identity: Administrators

distinguishedName : CN=Domain Admins,CN=Users,DC=Fabrikam,DC=com
name : Domain Admins
objectClass : group
objectGUID : 5ccc6037-c2c9-42be-8e92-c8f98afd0011
SamAccountName : Domain Admins
SID : S-1-5-21-41432690-3719764436-1984117282-512

distinguishedName : CN=Enterprise Admins,CN=Users,DC=Fabrikam,DC=com
name : Enterprise Admins
objectClass : group
objectGUID : 0215b0a5-aea1-40da-b598-720efe930ddf
SamAccountName : Enterprise Admins
SID : S-1-5-21-41432690-3719764436-1984117282-519

distinguishedName : CN=LabAdmin,CN=Users,DC=Fabrikam,DC=com
name : LabAdmin
objectClass : user
objectGUID : ab7c269d-aec5-4fcc-aebe-6cd1a2e6cd53
SamAccountName : LabAdmin
SID : S-1-5-21-41432690-3719764436-1984117282-1000

distinguishedName : CN=Administrator,CN=Users,DC=Fabrikam,DC=com
name : Administrator
objectClass : user
objectGUID : 994f46e6-c62c-483f-a6cf-124197b6a959
SamAccountName : Administrator
SID : S-1-5-21-41432690-3719764436-1984117282-500

Example 2: Get members of a group including the members of child groups

Get-ADGroupMember -Identity "Enterprise Admins" -Recursive
distinguishedName : CN=Administrator,CN=Users,DC=Fabrikam,DC=com
name : Administrator
objectClass : user
objectGUID : 994f46e6-c62c-483f-a6cf-124197b6a959
SamAccountName : Administrator
SID : S-1-5-21-41432690-3719764436-1984117282-500

distinguishedName : CN=Sagiv Hadaya,CN=Users,DC=Fabrikam,DC=com
name : Sagiv Hadaya
objectClass : user
objectGUID : 64706230-f179-4fe4-b8c9-f0d334e66ab1
SamAccountName : SHadaya
SID : S-1-5-21-41432690-3719764436-1984117282-1158

Supported parameters

The table below lists key parameters that can be used with the Get-ADGroupMember cmdlet to efficiently retrieve members of Active Directory groups.

Parameters Description
-AuthType Specifies the authentication method to use.
-Credential Specifies the user account credentials to use to perform this task.
-Identity Specifies the Active Directory group object by providing one of the following values:
  • A distinguished name
  • A GUID (objectGUID)
  • A security identifier (objectSid)
  • A Security Account Manager account name (sAMAccountName)
-Partition Specifies the distinguished name of an Active Directory partition.

Challenges of using PowerShell scripts to get Active Directory group members

  • IT admins must have in-depth PowerShell knowledge and familiarity with Active Directory cmdlets.
  • Complex scripts are required to recursively fetch nested group memberships accurately.
  • Large group sizes can slow down execution and lead to timeouts or memory issues.
  • Custom logic is often needed to filter specific attributes or include additional user details.
  • Output formatting and exporting for audits or reports demand extra scripting effort.

Highlights of using ADManager Plus to get Active Directory group members

  • Generate detailed group membership reports with just a few clicks.
  • View nested group memberships and filter by group type, scope, or OU without scripting.
  • Customize and schedule reports for automatic delivery to stakeholders or auditors.
  • Perform user management actions—like removing or transferring members—directly from reports.
  • Export reports in multiple formats such as CSV, PDF, XLS, or HTML for easy sharing and compliance.
  • Avoid complex PowerShell scripts with intuitive, GUI-based bulk user and group management tools.

Simplify Microsoft Entra ID user creation with ADManager Plus

 
  • Retrieving Active Directory group members
  • Get Active Directory group members using ADManager Plus
  • Get Active Directory group members using PowerShell
  • Challenges of using PowerShell scripts to get Active Directory group members
  • Highlights of using ADManager Plus to get Active Directory group members
The one-stop solution to Active Directory Management and Reporting
Email Download Link