title: list all local users using directory services
body: <p>The following method I created seem does not work. An error always happens on foreach loop.</p>
  
  <blockquote>
    <p>NotSupportedException was unhandled...The provider does not support
    searching and cannot search WinNT://WIN7,computer.</p>
  </blockquote>
  
  <p>I'm querying the local machine</p>
  
  <pre><code> 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
  
              }
          }
      }
  </code></pre>