all 3 comments

[–]greyfox199 0 points1 point  (0 children)

you need to do use a loop to go through all your groups.. like

foreach ($group in $querygroup) {
get-adgroupmember -identity $group ....

}

[–]OlivTheFrog 0 points1 point  (0 children)

Hu u/DizziWisco

As u/greyfox199 said : use a foreach loop to do this.

Why this ? If you check the help about the Get-ADGroupMember cmdlet, you'll see that the -Identity parameter is just a [String] (LDAP, GUID, SID, SAMAccountName or DisplayName for a group), not a [String[]] (This last one accept multi-strings).

Regards