Forum Discussion
Baron164
Sep 08, 2022Brass Contributor
Need help exporting list of enabled group members
So I have this simple one line that exports the members of a group. Get-ADgroupMember GroupName -Recursive | select Name | Sort-Object -Property Name | export-csv -Path \\domain.local\share...
Baron164
Sep 08, 2022Brass Contributor
So it's only providing me with two user accounts, which is the same that I was getting. My initial line when it's exporting everything returns over 100 users. But when I try to specify only enabled users I only get two listed. The group I'm currently trying to export from has a lot of nested groups within it.
Sep 08, 2022
(Get-ADgroupMember $group -Recursive | Where-Object objectClass -eq user).count is how many?
- Baron164Sep 08, 2022Brass Contributor659
- Sep 08, 2022Strangely enough, didn't expect that, on my test DC get-ADgroupMember group1 -Recursive gives me three accounts, two directly in group1 and one in the nested group2. get-ADgroupMember group1 gives me three members, two accounts, and one group.
What does (Get-ADgroupMember $group -Recursive).count give you?- Baron164Sep 09, 2022Brass ContributorThe same number, and even without the Recursive I get over 60 user accounts in the primary group alone. So I really don't understand why the script is only giving me two user accounts.