An LDAP application may return less information when a query is sent to a Windows Server 2008 or Windows Server 2008 R2 domain controller than when sent to a Windows Server 2003 domain controller. The query results may appear truncated or incomplete. In some occasions you may not get any results.
If, for example, a LDAP application queries the members of a group, the Windows Server 2008 R2 or Windows Server 2008 domain controller only returns 5000 members, while the Windows Server 2003 domain controllers returns many more members.
In both cases you may realize the same extended LDAP policy setting in NTDSUTIL required for the LDAP application. For more information about viewing the LDAP policy settings, click the following article number to view the article in the Microsoft Knowledge Base:
315071 How to view and set LDAP policy in Active Directory by using Ntdsutil.exe
ldap policy: show values
Note: On both domain controllers the setting MaxPageSize is set to 50000 (default 1000) and MaxValRange to 25000 (default 1500).
Internal LDAP limitations have been introduced in Windows Server 2008 R2 and Windows Server 2008 to prevent overloading the domain controller. These limits overwrite the LDAP policy setting when the policy value should be higher.
LDAP setting maximum value (hardcoded) MaxReceiveBuffer 20971520 MaxPageSize 20000 MaxQueryDuration 1200 MaxTempTableSize 100000 MaxValRange 5000
Therefore the effective setting for the above LDAP policy is MaxPageSize=50000 and MaxValRange=25000 on a Windows Server 2003 domain controller as configured in the LDAP policy but on a Windows Server 2008 R2 or Windows Server 2008 domain controller the hardcoded limits dictate MaxPageSize=20000 and MaxValRange=5000.
MaxValRange affects the number of attributes returned for a query. If you perform a LDAP query for the multi-valued attribute Member for a group object with more than 5000 members the Windows Server 2008 R2 or Windows Server 2008 domain controller will only return 5000 of them.
The new maximum limits introduced with Windows Server 2008 R2 and Windows Server 2008 try to enforce the message that applications should adopt to the policies AD wants to enforce. You should adapt your LDAP application accordingly.
For the MaxValRange limitation you may consider the following MSDN information and samples for using ranged queries:
Range Retrieval of Attribute Values
The following code example uses ranging to retrieve the members of a group using the IDirectoryObject interface:
Example Code for Ranging with IDirectoryObject
The following code example uses ranging to retrieve the members of a group using the IDirectorySearch interface:
Example Code for Ranging with IDirectorySearch
For MaxPageSize it is recommended to used paged queries, outlined on MSDN as follows:
Paging Search Results
There is a way to override these limitations, but we encourage to discuss the requirements with Microsoft customer technical support to decide if modifying the policies is the correct approach.
For more information about LDAP policies please visit
Article ID: 2009267 - Last Review: 08/28/2013 07:43:00 - Revision: 8.0