Solved

Count how many active directory group members for more than one AD group

Posted on 2016-09-01
2
45 Views
Last Modified: 2016-09-01
Hi EE

Wondering if anyone has had the need to report on how many group members exist for certain AD groups.  I need to set a task to report the total amount of AD group members for five groups and wanted to see if anyone had a PS script they can share.

The ideal output would be the total amount of users and group name .
0
Comment
Question by:MilesLogan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 40

Accepted Solution

by:
Subsun earned 500 total points
ID: 41779968
If it's just member count then you can use following code..

C:\group.txt should contain the group names which you want to lookup.
Import-Module Activedirectory
GC C:\group.txt | %{
	New-Object PSobject -Property @{
	Group = $_
	UserCount = (Get-ADGroupMember $_ -Recursive | Measure).Count
	}
}| Select Group,UserCount

Open in new window

0
 
LVL 2

Author Closing Comment

by:MilesLogan
ID: 41780675
Awesome ! thanks man , have a good weekend .
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

My attempt to use PowerShell and other great resources found online to simplify the deployment of Office 365 ProPlus client components to any workstation that needs it, regardless of existing Office components that may be needing attention.
There are times when we need to generate a report on the inbox rules, where users have set up forwarding externally in their mailbox. In this article, I will be sharing a script I wrote to generate the report in CSV format.
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles from a Windows Server 2008 domain controller to a Windows Server 2012 domain controlle…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.
Suggested Courses

615 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question