Error when tring to retrieve AuthorizationGroups from Active Directory

62 views Asked by At

I'm trying to go through about 11K users and retrieve their authorization Groups from Active Directory using UserPrincipal (C#, .NET 6):

PrincipalSearchResult<Principal> groups = up.GetAuthorizationGroups();

I've noticed that I'm getting the following error:

An error (5) occurred

on some of the users.

Later on I've noticed that I'm getting the same error, but on different users each run.

Furthermore, up.GetGroups() works every time.

I assume GetAuthorizationGroups takes longer, and by activating it on 11K users one by one I'm getting a timeout or something in that area.

Is there anyway to make it more efficient? Am I in the right direction?

I'll add that this process should take no longer than 30 minutes, so I used Parallel.Foreach on a bulk of 20 users.

Thank you in advance.

0

There are 0 answers