title: powershell output of ad-user pwdLastSet and LastLoginTimeStamp
body: <p>I'm working on a script that will run down a csv of LastName and FirstName of users on a domain and return someinfo about them in another csv. </p>
  
  <p>Returning the properties is not an issue, but when I try to convert pwdLastSet and LastLogonTimeStamp to a readable format, it crashes when writing to the csv.  </p>
  
  <p>Here is my code.  in this example, pwdLastSet will result in an unreadable 64bit number.</p>
  
  <pre><code>$names = import-csv C:\Users\me\Desktop\input.csv
  $users = @()
  
  foreach ($name in $names){
  
      $filter = "givenName -like ""*$($name.FirstName)*"" -and sn -like ""$($name.LastName)"""
      $users += get-aduser -filter $filter -Properties * | select-object employeeID, sn, givenName, distinguishedName, whencreated, passwordnotrequired, enabled, admincount, pwdlastset
  }
  
  $users | select employeeID, sn, givenName, distinguishedName, whencreated, passwordnotrequired, enabled, admincount, pwdlastset | export-csv c:\users\me\desktop\results.csv -NoTypeInformation
  </code></pre>
  
  <p>I'd like to throw <em>$([datetime]::FromFileTime($user.pwdLastSet))</em> so it's readable in the output. </p>
  
  <p>Any ideas?</p>