Unhandled Exception: System.Runtime.InteropServices.COMException:Unknown error (0x8007203b)
I am currently working on a console app that goes through active directory and exports all the computer object to a csv document. This is what I have so far however I keep getting the error noted above when I hit around 3 million computers. Any help would be great!
15 Replies
I am really unsure if this is a LDAP issue where I am getting a timeout. I have searched online and found something from years ago saying it was a weird error. That was only seen this in association with a
Kerberos authentication problem.
The error is ERROR_DS_LOCAL_ERROR. Have you tried setting the SizeLimit property of the DirectorySearcher to a larger value? Or possibly breaking it up into smaller chunks (like one OU at a time) ?
My guess is you are hitting some kind of resource limit but I haven't programmed against Active Directory in quite a while.
I am handling only one OU unfortunately. Let me try the size limit. Maybe a memory issue?
You really have 3 million computers in one OU? 👀
Intelligence is beyond us
In that case you can also try applying a filter to do batches - for instance, apply an LDAP search filter to get all computers starting with the letter A, repeat for B, and so on.
Ok I'll try this and come back.
One of my general rules that I have had to educate a lot of developers on is that search interfaces need to support paging, because at some point you might grow large enough that "Give me everything in one call" will tip over and die. I don't know if DirectorySearcher is doing paging behind the scenes, but it probably should be.
This doesn't look like paging to me 😬
Also, ArrayList :harold:
I never looked inside of it actually... I wonder if I don't use that it may work better I just figured it would be the easier route
If you don't use what?
DirectorySearcher?
Yes
Working directly with LDAP and/or using the COM object directly is probably a pain in the ass...
I used to use ldp.exe to directly write LDAP queries and I remember it was painful 🙂
Well this seems like a better warning then 😅 let me see what I can do. Thank you for all the help Mtreit
i use System.DirectoryServices.Protocols at work, it's cross platform so may use different less ancient and bad techniques
i haven't thrown it 3 million entries to search so idk
Quick update on this I changed the page size to 100 but am missing around 18000 computers I still need. It also takes up a bunch of RAM but cant see an option to free that up besides cleaning up during processing. I have tried DirectoryServices.Protocols. However I cannot seem to get the LDAP to work through it without username and password.
Ok I was able to figure it out with Protocols!
The memory filling up was from the findAll() statement
My issue with the ldap was just I wasn't putting the correct input. It just needed the IP and not full LDAP address url