Count Number of Users in Group

Posted by admin | Posted in Technical | Posted on 16-11-2012-05-2008


Today I was working with a client and needed a way to count all of the users in the group.  We knew of nothing that was currently installed that could do that but we thought power shell could be able to do it.  I have not needed to use powershell that much and for what I have needed it for it has be pretty well documented. I had to piece this together from a couple of different articles but here goes nothing.

  1. Launch power shell
  2. Run the command Import-Module ActiveDirectory (this will load in all the power shell commands for Active Directory)
  3. After that has finished loading you are going to need to run the following command to count the number of objects in a group (Get-ADGroupMember -Identity “Group Name”).Count (Note: Any nested groups will not be counted with this command)
  4. On the Next Line it will display the number of users that are added to this account.

If I have more time I will update this post on how to loop through nested groups.

Write a comment

This blog is kept spam free by WP-SpamFree.