title: LDAP query for users and computers in "Domain Computers" group
body: <p>I'm trying to build some LDAP query using PowerShell or C# to search for a certain user or computer in the "Domain Computers" predefined group.</p>
  
  <p>I know that it is not a regular group. </p>
  
  <p>It is possible to separate that query as follows:  </p>
  
  <p>For a computer in the "Domain Computers" group:</p>
  
  <pre><code>$strFilter = "(&amp;(objectClass=computer)(primaryGroupID=515)(name=MyPC))"
  </code></pre>
  
  <p>For a user in the "Domain Users" group:</p>
  
  <pre><code>$strFilter = "(&amp;(objectClass=user)(primaryGroupID=515)(name=MyUser))"
  </code></pre>
  
  <p>But I would like to find another query, due to some constrains.</p>
  
  <p>Using Active Directory searcher, I was able to find the "Domain Computers" group under the "Users" OU with the following parameters:     </p>
  
  <pre>distinguishedName = CN=Domain Computers,CN=Users,DC=MyDC,DC=local
  objectCategory = CN=Group,CN=Schema,CN=Configuration,DC=MyDC,DC=local
  objectClass = top ; group</pre>
  
  <p>I tried to build the query in the following syntax, with no success: </p>
  
  <p>For query a computer:</p>
  
  <pre><code>$strFilter = "(&amp;(objectCategory=group)(objectClass=computer)(name=MyPC)(CN=Domain computers,CN=Users,DC=supportlab,DC=lcoal))"
  </code></pre>
  
  <p>Any idea how can compose both queries for users and computers, using the above syntax?</p>