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

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 off
setlocal
if exist "%TEMP%\MxPgSz.TMP" del /q /f "%TEMP%\MxPgSz.TMP"
if \{%2\}==\{\} goto err
setlocal
set DC=%1
set DC=%DC:"=%
set OK=N
for /f "Tokens=*" %%a in ('ping -n 1 %DC%^|FIND "TTL="') do set OK=Y
if "%OK%" EQU "N" goto err1
set SZ=%2
set SZ=%SZ:"=%
@echo %SZ%|findStr "\[^0-9\]">nul
if %ERRORLEVEL% EQU 0 goto err2
set OK=N
call :quiet  >"%TEMP%\MxPgSz.TMP" 2>&1
for /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 err3
endlocal
goto :EOF
:quiet
ntdsutil "l p" con "co t s %DC%" q "set MaxPageSize to %SZ%" "Sh V" "com ch" q q
goto :EOF
:err
@echo Syntax: MxPgSz DC SZ
endlocal
goto :EOF
:err1
@echo Syntax: MxPgSz DC SZ - %DC% not found.
endlocal
goto :EOF
:err2
@echo Syntax: MxPgSz DC SZ - %SZ% is not numeric.
endlocal
goto :EOF
:err3
@echo Syntax: MxPgSz %DC% %SZ% - failed to update.
endlocal


Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish