Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2016-09-01
2
Medium Priority
?
53 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 2000 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

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Question has a verified solution.

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

Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
Here's a look at newsworthy articles and community happenings during the last month.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

670 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