Q. How can I set the maximum page size supported for LDAP responses in my domain?

Jerold Schulman

November 6, 2006

1 Min Read
ITPro Today logo in a gray background | ITPro Today

The maximum number of responses to an LDAP query (MaxPageSize) defaults to 1000.

I have scripted MxPgSz.bat to set the MaxPageSize to a value that you specify.

The syntax for using MxPgSz is:

[call] MxPgSz DC SZ

Where:

DC is the domain controller that you wish to connect to, generally the PDC emulator, like JSI001.SZ is the MaxPageSize value that you wish to set, like 2000.

NOTE: MxPgSz.bat uses the NTDSutil.exe tool.

MxPgSz.bat contains:

@echo offsetlocalif exist "%TEMP%MxPgSz.TMP" del /q /f "%TEMP%MxPgSz.TMP"if {%2}=={} goto errsetlocalset DC=%1set DC=%DC:"=%set OK=Nfor /f "Tokens=*" %%a in ('ping -n 1 %DC%^|FIND "TTL="') do set OK=Yif "%OK%" EQU "N" goto err1set SZ=%2set SZ=%SZ:"=%@echo %SZ%|findStr "[^0-9]">nulif %ERRORLEVEL% EQU 0 goto err2set OK=Ncall :quiet  >"%TEMP%MxPgSz.TMP" 2>&1for /f "Tokens=1* Delims=(" %%a in ('type "%TEMP%MxPgSz.TMP"^|FIND "MaxPageSize"') do ( if "%%b" NEQ "" set OK=Y)if exist "%TEMP%MxPgSz.TMP" del /q /f "%TEMP%MxPgSz.TMP"if "%OK%" EQU "N" goto err3endlocalgoto :EOF:quietntdsutil "l p" con "co t s %DC%" q "set MaxPageSize to %SZ%" "Sh V" "com ch" q qgoto :EOF:err@echo Syntax: MxPgSz DC SZendlocalgoto :EOF:err1@echo Syntax: MxPgSz DC SZ - %DC% not found.endlocalgoto :EOF:err2@echo Syntax: MxPgSz DC SZ - %SZ% is not numeric.endlocalgoto :EOF:err3@echo Syntax: MxPgSz %DC% %SZ% - failed to update.endlocal


Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like