title: DirectoryServices filter and methods
body: <p>I'm trying to get a list of all users in an OU/DC from AD.</p>
  
  <p>This is what I came up with:</p>
  
  <pre><code>$erroractionpreference = "SilentlyContinue"
  function Get-GroupMembers {
      $filter = "(&amp;(objectCategory=person)(objectClass=user))"
      $objSearcher = New-Object System.DirectoryServices.DirectorySearcher
      $objSearcher.Filter = $filter
      $colResults = $objSearcher.FindAll()
  
          foreach ($member in $colResults) { 
              $member
          }
  }
  get-GroupMembers 
  </code></pre>
  
  <p>If I change the filter to</p>
  
  <pre><code>    $filter = "(&amp;(objectCategory=person)(objectClass=user)("OU=Admin Accounts,DC=admin"))
  </code></pre>
  
  <p>Nothing returns. Why is this?<br>
  I would also like to display certain values (if the accounts is active or disabled etc) but if I pipe <code>$member</code> to <code>gm</code>, I get nothing.</p>
  
  <p>Any help would be greatly appreciated.</p>