private static GroupAttributes GetAttributes(Sid sid) { if (NtSecurity.IsServiceSid(sid)) { return(GroupAttributes.Owner | GroupAttributes.Enabled); } else if (NtSecurity.IsLogonSessionSid(sid)) { return(GroupAttributes.Enabled | GroupAttributes.EnabledByDefault | GroupAttributes.Mandatory | GroupAttributes.LogonId); } return(GroupAttributes.Enabled | GroupAttributes.EnabledByDefault | GroupAttributes.Mandatory); }