Solved

how to get AD group member count for a group with more then 5000 users

Posted on 2014-04-28
4
5,566 Views
Last Modified: 2014-04-28
Hi EE

I need to get the count for users in certain AD groups that have more then 10k users and neither of these options allow me to get the count . I don't want to modify the DC settings to expand the 5000 threshold  .  Does anyone have a work around for this ?

both of these fail .

Get-ADGroupMember "Test_Group" | Measure-Object | select count

If ([array]$users = (Get-ADGroupmember -Identity "Test_Group")) {
"Number of users in group: $($users.count)"
}
0
Comment
Question by:MilesLogan
  • 2
4 Comments
 
LVL 15

Expert Comment

by:WalkaboutTigger
ID: 40028576
Try this:

$members = Get-QADGroupMember -SizeLimit 0 'domain users' -ldap "(&(!userAccountControl:1.2.840.113556.1.4.803:=2))"
@($members).count

This does require the Quest PowerGUI from Dell, which can be found at

http://www.quest.com/powergui-freeware/
0
 
LVL 15

Accepted Solution

by:
WalkaboutTigger earned 250 total points
ID: 40028579
If you want to use native code, try

$group =[adsi]”LDAP://CN=Groupname,CN=Users,DC=domain,DC=local” 
$members = $group.psbase.invoke("Members") | foreach {$_.GetType().InvokeMember("name",'GetProperty',$null,$_,$null)} 
$members.count

Open in new window

0
 
LVL 40

Assisted Solution

by:footech
footech earned 250 total points
ID: 40028624
Here's another script bit using the adsisearcher type accelerator.  Just put in the name of your group instead of "some group" (can also use wildcards).  One note - it won't list members of the group that have that group set as the account's primary group.  If you never change this from "Domain Users" then it's not a problem.
([ADSISearcher]"(&(ObjectClass=group)(name=some group))").FindAll() | % {$_.properties.member}

Open in new window

0
 
LVL 2

Author Closing Comment

by:MilesLogan
ID: 40028742
Thank you both !! EE Rocks !
0

Featured Post

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

Suggested Solutions

A recent project that involved parsing Tableau Desktop and Server log files to extract reusable user queries for use in other systems. I chose to use PowerShell to gather the data, and SharePoint to present it...
A company’s centralized system that manages user data, security, and distributed resources is often a focus of criminal attention. Active Directory (AD) is no exception. In truth, it’s even more likely to be targeted due to the number of companies …
This tutorial will walk an individual through the steps necessary to configure their installation of BackupExec 2012 to use network shared disk space. Verify that the path to the shared storage is valid and that data can be written to that location:…
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.

679 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