public List<string> GetAllUsers(String Domain) { try { List<string> users = new List<string>(); PrincipalContext oPrincipal = GetPrincipalContext(Domain); GroupPrincipal gPrincipal = GroupPrincipal.FindByIdentity(oPrincipal, IdentityType.SamAccountName, "Domain Users"); if (gPrincipal != null) { foreach (Principal p in gPrincipal.GetMembers(false)) { users.Add(p.DisplayName); } } return users; } catch (Exception ex) { throw ex; } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)