Computer step by step
 Make your Pc better
Description:  

Specifies the maximum number of objects the system displays in response to a command to browse or
search Active Directory. This setting affects all browse displays associated with Active Directory, such as
those in Local Users and Groups, Active Directory Users and Computers, and dialog boxes used to set
permissions for user or group objects in Active Directory.

If you enable this setting, you can use the "Number of objects returned" box to limit returns from an Active
Directory search.

If you disable this setting or do not configure it, the system displays up to 10,000 objects. This consumes
approximately 2 MB of memory or disk space.

This setting is designed to protect the network and the domain controller from the effect of expansive
searches.

Supported on: Windows 2000 only.
Maximum size of Active Directory searches
Description Gpedit Regedit CMD Back VBScript PowerShell Script
Gpedit:   

Please perform the following steps:

Please go to Pearl button (Start) and click on the Search programs and files
For more information about the change from Start to Pearl button click here
Type gpedit.msc and press Enter
In the Group Policy window please navigate to User Configuration -> Administrative Templates ->
Desktop -> Active Directory and open Maximum size of Active Directory searches.
Not Configured -> is the Default state
Enabled -> apply this GPO
Disabled -> this GPO will not be applied

To finish press ok button and close Group Policy window.
Type regedit and press ok
Please confirm User Account Control pop-up
Microsoft official disclaimer

Warning Serious problems might occur if you modify the registry incorrectly by using Registry Editor or by
using another method. These problems might require that you reinstall the operating system. Microsoft
cannot guarantee that these problems can be solved. Modify the registry at your own risk.

Note: This registry key is created by Group Policy when this GPO is Enable. The GPO Default state is Not
Configured -> this registry entry is not present. For Disable this registry entry is not present.

Please navigate to HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\Directory UI and
locate
QueryLimit registry key
Regedit:          

Please perform the following steps:

Please go to Pearl button (Start) and click on the Search programs and files
For more information about the change from Start to Pearl button click here
   
   
Double click on QueryLimit and edit the value:

To Enable:
Change the data value with:
QueryLimit = 1

To finish press ok button and close Registry Editor window

Note: Manual editing of this registry key will not be reflected in Group Policy. If you modify this GPO from
Group Policy this registry key will be rewritten.
Type cmd, right click on cmd icon under the Programs and click on Run as administrator
Please confirm User Account Control pop-up
Please select, right and copy a registry key from below, then right click on command prompt window
, select Paste and press Enter

Enabled:
REG add "HKCU\Software\Policies\Microsoft\Windows\Directory UI" /v QueryLimit /t REG_DWORD /d 1 /f

Not Configured:
REG DELETE "HKCU\Software\Policies\Microsoft\Windows\Directory UI" /v QueryLimit /f

Note: Manual editing of this registry key will not be reflected in Group Policy. If you modify this GPO from
Group Policy this registry key will be rewritten.
CMD:          

Please perform the following steps:

Please go to Pearl button (Start) and click on the Search programs and files
For more information about the change from Start to Pearl button click here
   
VBScript:          

Const HKEY_CURRENT_USER = &H80000001
strComputer = "."
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
strComputer & "\root\default:StdRegProv")

strKeyPath = "Software\Policies\Microsoft\Windows\Directory UI"
oReg.CreateKey HKEY_CURRENT_USER,strKeyPath
strValueName = "QueryLimit"
'Enabled
dwValue = 1
oReg.SetDWORDValue HKEY_CURRENT_USER,strKeyPath,strValueName,dwValue
'Not Configured
'oReg.DeleteValue HKEY_CURRENT_USER,strKeyPath,strValueName
   
PowerShell Script :          

Enabled

$RegKey = "HKCU:\Software\Policies\Microsoft\Windows"
If(Test-Path ($RegKey + "\Directory UI"))
{
 $RegKey = "HKCU:\Software\Policies\Microsoft\Windows\Directory UI"
  ##Enabled
  New-ItemProperty -path $RegKey -name QueryLimit -value 1 -PropertyType DWord -Force
}
else
{
 New-Item -path $RegKey -name "Directory UI"
 $RegKey = "HKCU:\Software\Policies\Microsoft\Windows\Directory UI"
  ##Enabled
  New-ItemProperty -path $RegKey -name QueryLimit -value 1 -PropertyType String
}

Not Configured\Disabled

$RegKey = "HKCU:\Software\Policies\Microsoft\Windows"
Remove-ItemProperty -Path($RegKey + "\Directory UI") -name QueryLimit
If( (Get-Item -Path($RegKey + "\Directory UI")).ValueCount -eq 0 -and (Get-Item -Path($RegKey + "\Directory UI")).SubKeyCount -eq 0)
{
 Remove-Item -Path($RegKey + "\Directory UI")  
}
   
Up Back
   
Result
Result:

Need test pictures.
Verify code.