Listing members of a security group in Active Directory

So far we saw the addition of various Active Directory objects (users, computers, and groups) to security groups, but how do we know that they are actually added? How do we find out the current members of a given security group?

These questions can be simply answered with the Get-ADGroupMember cmdlet in Active Directory. As the name of the cmdlet indicates, it queries the members of a given group. For example, let's see the membership of one of the groups that we updated in the previous example, by using the following command:

Get-ADGroupMember -Identity ParentGroup1 | Measure-Object
Get-ADGroupMember -Identity ParentGroup1 | select Name

Refer to the following screenshot of the preceding command ...

Get Active Directory with PowerShell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.