Solved

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

Posted on 2016-09-01
2
36 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
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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

A procedure for exporting installed hotfix details of remote computers using powershell
This article runs through the process of deploying a single EXE application selectively to a group of user.
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 to another domain controller. Log onto the new domain controller with a user account t…
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 …

832 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