AD Search: More data is available, or time limit was exceeded



I'm searching in AD for computers (objectClass=computer) in a few
domains. The search works just fine in "small" domains with less than
1,000 of computer entries, and failed on domain with more than 4,000
entries. I do receive only first 560 objects and either get a timeout,
or app is never stopped.

Using System.DirectoryServices....

foreach (SearchResult r in searcher.FindAll())
{
....
}

I get an exception "DirectoryServicesCOMException: More data is
available" on the line with searcher.FindAll()

Using System.DirectoryServices.Protocols....

PageResultRequestControl pageRequest =
new PageResultRequestControl(20);

searchRequest.Controls.Add(pageRequest);

SearchOptionsControl searchOptions =
new SearchOptionsControl(SearchOption.DomainScope);

searchRequest.Controls.Add(searchOptions);

while (true)
{
....
}

(as descibed at http://msdn2.microsoft.com/en-us/library/bb332056.aspx)

I receive only first 28 of pages (560 computers) and a message
"DirectoryOperationException: The time limit set by the server-side
time limit parameter was exceeded."

If I set an additional settings to increase the timeout e.g.

connection.Timeout = new TimeSpan(0, 3, 30);

then after 560 entries and a while (about 1-2 min) I get another page
(#29) with 10(!) computers only (PageResultRequestControl(20)) and app
goes to hang.

So, my question is how to solve this problem and get all of computers?

Environment: ASP.NET2, DC - Win2000
.



Relevant Pages

  • Re: Input File for Script
    ... > everything I need to do when searching for members of the local ... > (computers.txt) that has all of the computers listed that I would like to ...
    (microsoft.public.windows.server.scripting)
  • ID old computers from Management Graphics?
    ... fit this, and my searching showed a couple similar questions here. ... The name on the computers state "Management Graphics" (Minneapolis, ... say "Sync Loop" and one that says "Sync Out". ...
    (sci.electronics.misc)
  • Re: Desktop Issue
    ... Mad Mike ... Sorry to sound ignorant, but I don't know much about computers. ... 20 minutes of searching, I found a way to connect to the internet to ...
    (microsoft.public.windows.vista.performance_maintenance)
  • Wrong place I know, show mercy
    ... Their independent election committee came to me yesterday to see if I could ... I have at my disposal 4 computers, ... I've written the teaching program in ... and I resume teaching in the morning and I can't keep searching. ...
    (microsoft.public.windows.file_system)
  • Re: backdoor.afcore.bb HELL
    ... Blocking Spyware, Adware, Parasites, Hijackers, Trojans, with a HOSTS file ... > free Firewall.With secure dll authentication enabled,by ... using registry entries and MSCONFIG itself ... >>> I've tried searching google but didn't find anything. ...
    (microsoft.public.security)