Powershell - Extract groups and users of a principal active directory group

Bernard Beaulieu 1 Reputation point
2022-02-08T19:43:34.177+00:00

Hi,

I would like to get something like this from AD :
AD GROUP ‘A’
AD GROUP ‘A child’
member ‘John D’
member ‘James B’
member ‘Joe D’
Member ‘Ma D’
AD GROUP ‘A child 2’
AD GROUP ‘B’
member ‘Mark T’
member ‘Mark M’

How can I get something like this (or better) using Powershell

I do not only want all the users from all the AD groups

Thank you,

Active Directory
Active Directory
A set of directory-based technologies included in Windows Server.
5,822 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,355 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Rich Matheisen 44,696 Reputation points
    2022-02-08T19:59:03.253+00:00

    Use Get-ADGroupMember but don't use the -Recursive parameter.