0

I have an AD group with 26500 members. And I need a list with all SamAccountNames of these 26500 members.

I've tried it with ADSI (Get-AdGroup etc. does not work with that amount of members), but my code only returns 1500 members:

$Group = [ADSI]"LDAP://DN name of the AD group"
$Members = $Group.Member | ForEach-Object {[ADSI]"LDAP://$_"}| Select-Object @{e={$_.SamAccountName}}| Out-File "C:\Temp\ADusers.txt"

How can I get all 26500?

BR

user18209625
  • 113
  • 5
  • you can also use: `Get-ADUser -LDAPFilter "(&(objectCategory=user)(memberof=CN=groupname,OU=Groups,OU=rest,DC=of,DC=distinguished,DC=name))"` as a workaround – Abraham Zinala Apr 26 '22 at 16:42

0 Answers0