Steps to reproduce:
- Install an AD LDS instance on Windows Server 2012.
- Create a partition, e.g. CN=MyPartition.
- Install one of the following updates: KB3156416 orKB3160352.
- Create20 containers in the root of your partition.
- Run the following PowerShell script:
$port = 389 $computerName = "computer.domain.com" $strFilter = "(&(objectCategory=Container)(|(showInAdvancedViewOnly=FALSE)(showInAdvancedViewOnly=TRUE)))" $searchRoot = New-Object System.DirectoryServices.DirectoryEntry "LDAP://$computerName`:$port/CN=MyPartition" $objSearcher = New-Object System.DirectoryServices.DirectorySearcher $objSearcher.SearchRoot = $searchRoot $objSearcher.Filter = $strFilter $objSearcher.SearchScope = "Subtree" try { $results = $objSearcher.FindAll() foreach ($objResult in $results) { $objResult.Path } } finally { if ($objSearcher) { $objSearcher.Dispose() } }
RESULT: None, i.e. the search will not return any results (though it should). Also, you will get the following exception:
System.DirectoryServices.Protocols.DirectoryOperationException: An operation error occurred.
If there are less than 20 containers or if you specify a page size for theDirectorySearcher interface, the script will return your containers.
Uninstalling KBs mentioned on step 3 will fix the issue. Also, the same KBsdo not cause the issue on other operating systems (we've checked on Windows Server 2012r2, 2008r2, 7, 8, 8.1 and 10).