I have recently encountered the following error when enumerating through the UserPrincipal.GetAuthorizationGroups collection.
System.DirectoryServices.AccountManagement.PrincipalOperationException: An error (1301) occurred while enumerating the groups. The group's SID could not be resolved.
The problem was introduction of the domain controller running Server 2012 while the machine running my application was win7 VM (applies to Win2K8 as well)
With little googling, it appears that for the Windows 7 VM with introduction of 2012 domain controller, this SID error appears to be a known issue. When a 2012 domain controller is involved, the GetAuthorizationGroups() function would fail on groups (SIDs) that are added to a user by default.
Installing KB2830145 fixed my problem.
References
- GetAuthorizationGroups() Fails on Windows 2008 R2/WIN7
- StackOverflow: UserPrincipals.GetAuthorizationGroups An error (1301) occurred while enumerating the groups. After upgrading to Server 2012 Domain Controller
- KB2830145: SID S-1-18-1 and SID S-1-18-2 cannot be mapped on Windows-based computers in a domain environment