How to count how many users a group has, including nested groups

I must admit that i was searching for one hour how to see how many members a given group has, so something like a count of members but also including nested groups. It’s a sweet PowerShell command for you guys making reports like i do.
Well here it is:

Get-QADGroup group_nam* -SizeLimit 0 | Select-Object Name,@{n='MemberCount';e={ (Get-QADGroupMember -Indirect -SizeLimit 0 $_ | Measure-Object).Count}}

The * (star) before -SizeLimit is telling powershell to apply the command for all groups begging with “group_nam”, so the query is valid for “group_name” but also for “group_name_in_another_location”

By removing the -Indirect statement, you get only the direct members, excluding nested ones (members of other groups, inside given group)


Victor an End User Computing Consultant. You find him most of the time on Twitter (@01004753) but also on LinkedIn evangelizing new technologies and processes that can change in good, the world we live in. Victor has expertise in Server & Client Virtualization, Client Management, GPU Virtualization, HyperConvergence and Enterprise Security

Posted in HowTo, PowerShell

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Follow Victor Homocea on
My Gravatar

Storage, Virtualization, Container Orchestration

Marius Sandbu

cu camera pe bord

Stuff about WindowsVirtualDesktop

Ingmar Verheij

About Citrix, Remote Desktop, Performance, Workspace, Monitoring and more...

Carl Stalhood

Filling gaps in EUC vendor documentation

Don't Follow the Trend

Victor Homocea

Ray Heffer

Enterprise Technologies

Elvis Apostol

Calatorind prin lumi indepartate, pictez in cuvinte, lacrimi de culori.

%d bloggers like this: