PowerShell question for you savvy folks. Is it possible to filter a Get-ADGroup
command based on group size (aka only return groups greater than x members)? I'm trying to filter in a more efficient way than:
Get-ADGroup -Filter *
and then running the member count check after, as in | where {$_.members.count -gt 10,000}
or something.
But I'm having a hard time doing any kind of member count check on the initial filter so I don't have to return every group object in the individual domain and then check membership count. This is because the AD instance I'm querying against has a huge amount of AD groups that takes a long time to pull all groups first, then check.
I've tried variations of the below, but I'm guessing that the initial "members" property doesn't exist in the attribute set you can query against:
Get-ADGroup -Properties members -Filter {members -ge 10,000}
Any help is appreciated!