Solved

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

Posted on 2016-09-01
2
27 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
2 Comments
 
LVL 40

Accepted Solution

by:
Subsun earned 500 total points
Comment Utility
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
Comment Utility
Awesome ! thanks man , have a good weekend .
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
I thought I'd write this up for anyone who has a request to create an anonymous whistle-blower-type submission form created using SharePoint 2010 (this would probably work the same for 2013). It's not 100% fool-proof but it's as close as you can get…
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…
This tutorial will walk an individual through the process of configuring their Windows Server 2012 domain controller to synchronize its time with a trusted, external resource. Use Google, Bing, or other preferred search engine to locate trusted NTP …

744 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now