KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
The following method I created seem does not work. An error always happens on foreach loop. NotSupportedException was unhandled...The provider does not support searching and cannot search WinNT://WIN7,computer. I'm querying the local machine private static void listUser(string computer) { using (DirectoryEntry d= new DirectoryEntry("WinNT://" + Environment.MachineName + ",computer")) { DirectorySearcher ds = new DirectorySearcher(d); ds.Filter = ("objectClass=user"); foreach (SearchResult s in ds.FindAll()) { //display name of each user } } }
Tags (comma-separated)
Save Edits
Cancel