Microsoft KB Archive/315071

= How to view and set LDAP policy in Active Directory by using Ntdsutil.exe =

Article ID: 315071

Article Last Modified on 3/27/2007

-

APPLIES TO


 * Microsoft Windows 2000 Server
 * Microsoft Windows 2000 Advanced Server
 * Microsoft Windows Server 2003, Standard Edition (32-bit x86)
 * Microsoft Windows Server 2003, Enterprise Edition (32-bit x86)

-



This article was previously published under Q315071



IN THIS TASK

 * SUMMARY
 * Windows 2000 and Windows Server 2003 LDAP administration limits
 * Starting Ntdsutil.exe
 * Viewing current policy settings
 * Modifying policy settings
 * Considerations for changing query values
 * Instructions for configuring per domain controller or per site policy
 * Sample script
 * REFERENCES



SUMMARY
This step-by-step article describes how to manage Lightweight Directory Access Protocol (LDAP) policies by using the Ntdsutil.exe tool. To make sure that domain controllers can support service-level guarantees, you must specify operational limits for a number of LDAP operations. These limits prevent specific operations from adversely affecting the performance of the server, and also make the server more resilient to some types of attacks.

LDAP policies are implemented by using objects of the queryPolicy class. Query Policy objects can be created in the Query Policies container, which is a child of the Directory Service container in the configuration naming context. For example: cn=Query-Policies, cn=Directory Service, cn=Windows NT, cn=Services.

back to the top

Windows 2000 and Windows Server 2003 LDAP administration limits
The LDAP administration limits are:
 * InitRecvTimeout - This value defines the maximum time in seconds that a domain controller waits for the client to send the first request after the domain controller receives a new connection. If the client does not send the first request in this amount of time, the server disconnects the client.

Default value: 120 seconds
 * MaxActiveQueries - The maximum number of concurrent LDAP search operations that are permitted to run at the same time on a domain controller. When this limit is reached, the LDAP server returns a &quot;busy&quot; error.

Default value: 20

Note This control has an incorrect interaction with the MaxPoolThreads value. MaxPoolThreads is a per-processor control, while MaxActiveQueries defines an absolute number. Starting with Windows Server 2003, MaxActiveQueries is no longer enforced. Additionally, MaxActiveQueries does not appear in the Windows Server 2003 version of NTDSUTIL.

Default value: 20
 * MaxConnections - The maximum number of simultaneous LDAP connections that a domain controller will accept. If a connection comes in after the domain controller reaches this limit, the domain controller drops another connection.

Default value: 5000
 * MaxConnIdleTime - The maximum time in seconds that the client can be idle before the LDAP server closes the connection. If a connection is idle for more than this time, the LDAP server returns an LDAP disconnect notification.

Default value: 900 seconds
 * MaxDatagramRecv - The maximum size of a datagram request that a domain controller will process. Requests that are larger than the value for MaxDatagramRecv are ignored.

Default: 1,024 bytes
 * MaxNotificationPerConnection - The Maximum number of outstanding notification requests that are permitted on a single connection. When this limit is reached the server returns a &quot;busy&quot; error to any new notification searches that are performed on that connection.

Default value: 5
 * MaxPageSize - This value controls the maximum number of objects that are returned in a single search result, independent of how large each returned object is. To perform a search where the result might exceed this number of objects, the client must specify the paged search control. This is to group the returned results in groups that are no larger than the MaxPageSize value. To summarize, MaxPageSize controls the number of objects that are returned in a single search result.

Default value: 1,000
 * MaxPoolThreads - The maximum number of threads per-processor that a domain controller dedicates to listening for network input or output (I/O). This value also determines the maximum number of threads per-processor that can work on LDAP requests at the same time.

Default value: 4 threads per-processor
 * MaxResultSetSize - Between the individual searches that make up a paged result search, the domain controller may store intermediate data for the client. The domain controller stores this data to speed up the next part of the paged result search. The MaxResultSize value controls the total amount of data that the domain controller stores for this kind of search. When this limit is reached, the domain controller discards the oldest of these intermediate results to make room to store new intermediate results.

Default value: 262,144 bytes
 * MaxQueryDuration - The maximum time in seconds that a domain controller will spend on a single search. When this limit is reached, the domain controller returns a &quot; timeLimitExceeded&quot; error. Searches that require more time must specify the paged results control.

Default value: 120 seconds
 * MaxTempTableSize - While a query is processed, the dblayer may try to create a temporary database table to sort and select intermediate results from. The MaxTempTableSize limit controls how large this temporary database table can be. If the temporary database table would contain more objects than the value for MaxTempTableSize, the dblayer performs a much less efficient parsing of the complete DS database and of all the objects in the DS database.

Default value: 10,000 records
 * MaxValRange - This value controls the number of values that are returned for an attribute of an object, independent of how many attributes that object has, or of how many objects were in the search result. In Windows 2000 this control is &quot;hard&quot; coded at 1,000. If an attribute has more than the number of values that are specified by the MaxValRange value, you must use value range controls in LDAP to retrieve values that exceed the MaxValRange value. MaxValueRange controls the number of values that are returned on a single attribute on a single object.



back to the top

Starting Ntdsutil.exe
Ntdsutil.exe is located in the Support tools folder on the Windows 2000 installation CD-ROM. By default, Ntdsutil.exe is installed in the System32 folder.
 * 1) Click Start, and then click Run.
 * 2) In the Open text box, type ntdsutil, and then press ENTER. To view help at any time, type ? at the command prompt.

back to the top

Viewing current policy settings

 * 1) At the Ntdsutil.exe command prompt, type LDAP policies, and then press ENTER.
 * 2) At the LDAP policy command prompt, type connections, and then press ENTER.
 * 3) At the server connection command prompt, type connect to server DNS name of server, and then press ENTER. You want to connect to the server that your are currently working with.
 * 4) At the server connection command prompt, type q, and then press ENTER to return to the previous menu.
 * 5) At the LDAP policy command prompt, type Show Values, and then press ENTER.

A display of the policies as they exist appears.

back to the top

Modifying policy settings

 * 1) At the Ntdsutil.exe command prompt, type LDAP policies, and then press ENTER.
 * 2) At the LDAP policy command prompt, type Set setting to variable, and then press ENTER. For example, type Set MaxPoolThreads to 8.

This setting changes if you add another processor to your server.
 * 1) You can use the Show Values command to verify your changes.

To save the changes, use Commit Changes.
 * 1) When you finish, type q, and then press ENTER.
 * 2) To quit Ntdsutil.exe, at the command prompt, type q, and then press ENTER.

back to the top

Note This procedure only shows the Default Domain Policy settings. If you apply your own policy setting, you cannot see it.

Considerations for changing query values
To maintain domain server resiliency, we do not recommend that you increase the timeout value of 120 seconds. Forming more efficient queries is a preferred solution. For more information about creating efficient queries, visit the following Microsoft Web site:

http://msdn2.microsoft.com/en-us/library/ms808539.aspx

However, if changing the query is not an option, increase the timeout value only on one domain controller or only on one site. For instructions, see the next section. If the setting is applied to one domain controller, reduce the DNS LDAP priority on the domain controller so that clients are less likely use the server for authentication. On the domain controller with the increase priority, use the following registry setting to set LdapSrvPriority:

On the Edit menu, click Add Value, and then add the following registry value:

Entry name: LdapSrvPriority

Data type: REG_DWORD

Value: Set the value to the value of the priority that you want.

For additional information, click the following article number to view the article in the Microsoft Knowledge Base:

306602 How to optimize the location of a domain controller or global catalog that resides outside of a client's site

Instructions for configuring per domain controller or per site policy
 Create a new query policy under:

CN=Query-Policies,CN=Directory Service,CN=Windows NT,CN=Services,CN=Configuration,

 Set the domain controller or site to point to the new policy by entering the distinguished name of the new policy in the &quot;Query-Policy-Object&quot; attribute. The location of the attribute is a follows:

The location for the domain controller is:

CN=NTDS Settings, CN=, CN=Servers,CN= ,CN=Sites,CN=Configuration,

The location for the site is:

CN=NTDS Site Settings,CN= ,CN=Sites,CN=Configuration,



Sample script
You can use the following text to create an Ldifde file. You can import this file to create the policy with a timeout value of 10 minutes. Copy this text to Ldappolicy.ldf, and then run the following command, where  is the distinguished name of your forest root. Leave DC=X as-is. This is a constant that will be replaced by the forest root name when the script runs. The constant X does not indicate a domain controller name.

ldifde -i -f ldappolicy.ldf -v -c DC=X DC= 

Start Ldifde script
dn: CN=Extended Timeout,CN=Query-Policies,CN=Directory Service,CN=Windows NT,CN=Services,CN=Configuration,DC=X changetype: add instanceType: 4 lDAPAdminLimits: MaxReceiveBuffer=10485760 lDAPAdminLimits: MaxDatagramRecv=1024 lDAPAdminLimits: MaxPoolThreads=4 lDAPAdminLimits: MaxResultSetSize=262144 lDAPAdminLimits: MaxTempTableSize=10000 lDAPAdminLimits: MaxQueryDuration=300 lDAPAdminLimits: MaxPageSize=1000 lDAPAdminLimits: MaxNotificationPerConn=5 lDAPAdminLimits: MaxActiveQueries=20 lDAPAdminLimits: MaxConnIdleTime=900 lDAPAdminLimits: InitRecvTimeout=120 lDAPAdminLimits: MaxConnections=5000 objectClass: queryPolicy showInAdvancedViewOnly: TRUE After you import the file, you can change the query values by using Adsiedit.msc or Ldp.exe. The MaxQueryDuration setting in this script is 5 minutes.

Note Ntdsutil.exe only displays the value in the default query policy. If any custom policies are defined, they are not displayed by Ntdsutil.exe.

