Last active
December 17, 2015 03:29
-
-
Save v2m/5543629 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// add reference to System.DirectoryServices.AccountManagement.dll | |
var sidAttr = pool.Attributes["applicationPoolSid"]; | |
var securityIdentifier = new SecurityIdentifier((string)sidAttr.Value); | |
using(var ctx = new PrincipalContext(ContextType.Machine)) | |
using(var group = GroupPrincipal.FindByIdentity(ctx, IdentityType.Sid, (string)securityIdentifier.Value)) | |
{ | |
Debug.Assert(group != null); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment