title: Trying to filter an AD export script in powershell by user type?
body: <p>I've been asked to pull a report containing User's name, username, enabled/disabled, and the last login time from our Windows server 2008 domain. I'm using the script below and it's working, but the problem is it's pulling built-in security accounts and some system accounts, and I need just users. Does anyone know if this filtering is possible? The script I'm using is below. Thanks in advance!</p>
  
  <pre><code>$ADUserParams=@{
  'Server' = 'servername.domain.local'
  'Searchbase' = 'DC=domain,DC=local'
  'Searchscope'= 'Subtree'
  'Filter' = '*'
  'Properties' = '*'
  }
  
  
  $SelectParams=@{
  'Property' = 'CN', 'SAMAccountname', 'DisplayName', 'enabled', 'lastlogondate',
  }
  
  get-aduser @ADUserParams | select-object @SelectParams  | export-csv "c:\temp\users.csv"
  </code></pre>