Forum Discussion
sparkislife
Apr 21, 2022Copper Contributor
List off all AD groups that have between 1 and 3 users
I am looking for help with listing off all AD Groups that have between 1 and 3 members.
Did my example help you?
sparkislife
Apr 25, 2022Copper Contributor
- Apr 25, 2022Ok, thats strange... After running the script, did it do anything? Did it create a c:\temp\groups.csv file? Does running Get-ADGroup -Filter * -ResultSetSize 100000 | Sort-Object Name give you any results?
- sparkislifeApr 25, 2022Copper Contributor
I am looking to get almost a thousand groups. Am sorry I had to abort it as it kept throwing the unspecified error at me.
I went this route so far.
Get-ADGroup -Filter * -Properties Member | Select-Object Name,@{n="MemberCount";e={$_.Member.Count}} |export-csv -NoTypeInformation -Encoding UTF8 -Delimiter ';' -Path C:\temp\groups.csv got me the each group by name and count- Apr 26, 2022Not sure why the error is there in your case, it does work on a 2022 DC with not that many groups but should work with a lot more groups without any problems. @LianRobertson posted an adjustment to your line below which should work