How to find users in AD that belong to a group, and just get their SAMAccountName, and SID?
问题 I just want a user to be able to type in a group name in a textbox, and return just their login name and their SID. So far i have this, and that loads the users in the group but im unsure how to extract the login and SID. SearchResult result; DirectorySearcher search = new DirectorySearcher(); search.Filter = String.Format("(cn={0})", txtGroup.Text); search.PropertiesToLoad.Add("member"); search.PropertiesToLoad.Add("cn"); search.PropertiesToLoad.Add("objectGUID"); result = search.FindOne();