简体   繁体   中英

How to get users of a group in a group AD PowerShell

I want to get all Members of a group testgroup1 , but inside this group are other groups testgroup2 , testgroup3 .

The output of Get-ADGroupMember "testgroup1" is a list of members inside testgroup1 but it lists all the other groups inside like Members.

How can I get all members of the testgroup1 and all the members of the groups that are inside it?

If you read the documentation for Get-ADGroupMember you'll find a parameter called Recursive

This will check the memberships of any child groups (groups that are in your group), and display the members of those groups as well as the direct members of your group.

Simply update you command like this:

Get-ADGroupMember "testgroup1" -Recursive

Use the switch parameter Recursive

Example:

Get-ADGroupMember -Identity "yourgroup" -Recursive

Take a look at the documentation of the cmdlt on technet https://technet.microsoft.com/de-de/library/hh852290(v=wps.630).aspx

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM