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