title: display groups belonging to domain users
body: <p>I have 2 users one on local machine and one on domain.: <code>user1</code> &amp; <code>testdomain\user1</code></p>
  
  <p>Now both these users have different groups</p>
  
  <pre><code>user1 = group1, group3
  
  testdomain\user1 = group2, group4
  </code></pre>
  
  <p>Now I wish to display these groups, I have no trouble displaying the groups of <code>user1</code> but I cannot display the groups of <code>testdomain\user1</code>. </p>
  
  <p>My code is as below.</p>
  
  <pre><code>DirectoryEntry AD = new DirectoryEntry("WinNT://" + Environment.MachineName + ",computer");
  DirectoryEntry user = AD.Children.Find(completeUserName, "user");
  object obGroups = user.Invoke("Groups");
  
  foreach (object ob in (IEnumerable)obGroups)
  {
      // Create object for each group.
      DirectoryEntry obGpEntry = new DirectoryEntry(ob);
      listOfMyWindowsGroups.Add(obGpEntry.Name);
  }
  </code></pre>
  
  <p>where completeusername = user1 and testdomain\user1</p>
  
  <p>Any suggestions?</p>