Home > Error Occurred > An Error Occurred While Enumerating

An Error Occurred While Enumerating


using (var context = new PrincipalContext(ContextType.Domain, _domainName)) { try { var p = UserPrincipal.FindByIdentity(context, IdentityType.SamAccountName, username); if (p == null) throw new NullReferenceException(string.Format("UserPrincipal.FindByIdentity returned null for user: {0}, this can indicate Log files contain a message "An error (1301) occurred while enumerating the groups. What are the Starfleet regulations on crew relationships or fraternizing? An error occurred while enumerating the groups. this contact form

Why do we not require websites to have several independent certificates? Cause I'm had nested groups, I'm used GetMembers(true) and it's little bit longer in time than GetMembers(). Posted by Roni Schuetz on 12/31/2009 at 3:36 AM I have the same problem but on a Windows Server 2008 SP2. I find it stunning to see that we just need the work around and that more users will have to experience this issue. http://stackoverflow.com/questions/17027781/userprincipals-getauthorizationgroups-an-error-1301-occurred-while-enumerating

An Error Occurred While Enumerating Through A Collection More Data Is Available

I could easily reproduce the issue using PowerShell: Function Get-UserPrincipal($cName, $cContainer, $userName){ $dsam = "System.DirectoryServices.AccountManagement" $rtn = [reflection.assembly]::LoadWithPartialName($dsam) $cType = "domain" #context type $iType = "SamAccountName" Disclaimer: This is my first post to Stack Overflow, I often research here but have not joined in discussions until now. more stack exchange communities company blog Stack Exchange Inbox Reputation and Badges sign up log in tour help Tour Start here for a quick overview of the site Help Center Detailed

What does Sauron need with mithril? Exception: Exception information: Exception type: PrincipalOperationException Exception message: An error (1301) occurred while enumerating the groups. Updated today and will continue to monitor the issue. An Error Occurred While Trying To Enumerate Your Resources We also had pre-2012 DCs in place and so we experienced the issue intermittently.

It solves our problem! –dnx Mar 6 '14 at 10:43 Danke, solved issue for me. (Win 2008 R2 connect to Win 2012 AD server) –Tilo Aug 7 '14 at An Error Occurred While Enumerating Through A Collection Access Is Denied Is you issue similar to this bug: GetAuthorizationGroups not returning SG's even though LDAP queries returns appropriate result? –Alex Filipovici May 2 '13 at 15:29 Yep, except I'm not slams skull into desk –Pynt Jun 20 '13 at 11:59 1 We got the same issue few weeks ago. http://dev.net.ua/blogs/ivanbilokon/archive/2015/03/05/12796.aspx Certain groups that we were interrogating had a null sAMAccountName property.

I don't believe that our AD list will take a large amount of time to validate for orphaned SID's. An Error Occurred While Applying Security Information To Failed To Enumerate Resource on Leak –Pynt Jun 12 '13 at 16:58 Update: Still had a few bits of code that were not properly disposing. I have implemented a try catch to work around this, but I am wondering if I can just use this nice code block you have provided with some minor tweaks? current community chat Stack Overflow Meta Stack Overflow your communities Sign up or log in to customize your list.

An Error Occurred While Enumerating Through A Collection Access Is Denied

Blogger Template by Anshul. i thought about this The code Iused is below using (var principalContext =

Fig. 1. weblink When a 2012 domain controller is involved, the GetAuthorizationGroups() function would fail on groups (SIDs) that are added to a user by default. Where does the term "Praise the Sun" come from? Terms and conditions of support Detailed provisions, benefits, ordering and technical support model information. An Internal Error Occurred While Enumerating Backup Sets Server 2008

Next Post: Latest [email protected] @MarkTabNet: Thanks @EdwardTufte @_brohrer_ @adnanmasood for being top engaged community members this week 🙂 - posted on 29/09/2016 10:06:42 Recent Posts Notes from Microsoft Machine Learning and Original Code public bool isGroupMember(string userName, ArrayList groupList) { bool valid = false; PrincipalContext ctx = new PrincipalContext(ContextType.Domain, domain_server + ".domain.org:636", null, ContextOptions.Negotiate | ContextOptions.SecureSocketLayer); // find the user in the Instead of calling either of those, after constructing the user object, I also construct a group object, one for each group I want to see if the user is a member navigate here Find a local reseller Do you need to buy from a local reseller?

Is 8:00 AM an unreasonable time to meet with my graduate students and post-doc? An Error Occurred While Applying Security Information To Failed To Enumerate Objects I am receiving the "enumerating through a collection" error as I understand you cant edit the current collection, I am quite new to powershell and having looked at answers I dont My girlfriend has mentioned disowning her 14 y/o transgender daughter Why can a Gnome grapple a Goliath?

His customer had a Windows 2008 R2 server with a custom .NET application on it.

I believe these would be what are known as "tombstoned" SIDS in active directory. Client list Some of the major companies from around the world using our applications. The next day we started receiving the exception listed below. Citrix An Error Occurred While Trying To Enumerate Your Resources list-view share|improve this question edited Aug 9 '13 at 8:15 asked Oct 11 '12 at 10:28 Colin Cook 1015 add a comment| 1 Answer 1 active oldest votes up vote 2

Recently some users have been getting the error mentioned in the title (System.DirectoryServices.AccountManagement.PrincipalOperationException) while others have not. The script checks if the view already exists and then it checks if the new view has been set to the default view, if the new view is the default, it The code I utilized which failed with error "System.DirectoryServices.AccountManagement.PrincipalOperationException: An error (1301) occurred while enumerating the groups. (This was replicated as both a standard user and the domain administrator, so it his comment is here Not the answer you're looking for?

Which file formats are used to make viruses in Ubuntu? I was able to recursively obtain a list of a user's group membership using the following code: class ADGroupSearch { List groupNames; public ADGroupSearch() { this.groupNames = new List(); } public Redefining cases command Can Customs make me go back to return my electronic equipment or is it a scam? Gary share|improve this answer answered Oct 15 '13 at 14:45 Gary Hill 18614 Thanks for the info.

I worked out the case sensitive stuff. 3) The method GetGroupsNew takes a username and returns a list of groups 4) The method isMemberofnew takes a username and a group and Will monitor for issues. // test membership in SuperUsers const string superUsersGroupName = "MyApp-SuperUsers"; using (var superUsers = GroupPrincipal.FindByIdentity(principalContext, superUsersGroupName)) { if (superUsers != null && user.IsMemberOf(superUsers)) // add to the Why us? These are most likely bogus SIDs that may be removed.http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/9dd81553-3539-4281-addd-3eb75e6e4d5dI will post my workaround in the Workaround section.