Monday, November 7, 2016

The size limit for this request was exceeded


get-adgroupmember is unable to return results when the number of members is very high.  To work around this use the get-adobject cmdlet with a LDAPFilter as follows

Get-ADObject -LDAPFilter "(memberOf=CN=MyGroupName,OU=OUNAME1,OU=OUNAME2,OU=OUNAME3,DC=xxx,DC=xxx,DC=local)" | where {$_.ObjectClass -eq "user"} | measure



Use this get-adobject string to get the objects like groups in an OU

Get-ADObject -Filter {Name -like "*"} -Searchbase 'OU=UserAccounts,DC=Fabrikam,DC=com'

https://technet.microsoft.com/en-us/library/dd391882%28v=ws.10%29.aspx