title: How do I select the extended properties of an [Active Directory] object?
body: <p>I'm looking to pull a report of all our Active Directory accounts, include certain attributes/properties on each, and pipe it into a .csv file, so I can add formatting and filters (and so on like to) for management.</p>
  
  <p>I've got a list of attributes that they want included (DisplayName, SamAccountName, Enabled, Created, AccountExpirationDate, LastLogonDate, PasswordLastSet, EmailAddress), most of which are <a href="http://social.technet.microsoft.com/wiki/contents/articles/12037.active-directory-get-aduser-default-and-extended-properties.aspx" rel="nofollow">extended properties of the Get-ADUser cmdlet</a>.  I first tried to grab them like the default attributes, as below:</p>
  
  <pre><code>Get-ADUser -Filter * -SearchBase "dc=somedomain,dc=tld" `
  | select DisplayName, SamAccountName, Enabled, Created, AccountExpirationDate, LastLogonDate, PasswordLastSet, EmailAddress `
  | export-csv c:\DominAccountsPasswordInfoDump.csv -NoTypeInformation
  </code></pre>
  
  <p>...but that didn't work, as extended properties <a href="http://social.technet.microsoft.com/wiki/contents/articles/12031.active-directory-powershell-ad-module-properties.aspx#Extended_Properties" rel="nofollow">"are only retrieved if they are specified in the -Properties parameter of the cmdlet"</a>, so I got a .csv with a bunch of blank columns.</p>
  
  <p>Now my problem is that I don't know how to specify the <code>-Properties</code> parameter within my <code>select</code> statement, (I seem to get the below error message every way I try)</p>
  
  <blockquote>
    <p>Select-Object : A parameter cannot be found that matches parameter name 'Parameters'.</p>
  </blockquote>
  
  <p>And on thinking about the <code>select-object</code> part of that, I'm starting to wonder if I need to define each user object I read in (assign it a to <code>$user</code> variable, or something), at which point I figured I should probably ask for help before mucking around any further.  Since searching Google and StackExchange didn't help, I'm asking here.</p>
  
  <p>How do I select the extended properties of an AD user?  (Ideally, using the one-line script/PowerShell command I've got above.)</p>