I often find myself needing to convert the LastLogonTimeStamp attribute from Active Directory to Datetime with PowerShell. What I have done, is that in my PowerShell profile ($profile) I have added a function ConvertFrom-LastLogonTimeStamp to get the value as a Datetime.
Easier to remember!
function ConvertFrom-LastLogonTimestamp { [CmdletBinding()] [OutputType([datetime])] Param ( # LastLogonTimestamp from AD [Parameter(Mandatory=$true, ValueFromPipeline=$true, Position=0)] [String] $LastLogonTimestamp ) return [datetime]::FromFileTime($LastLogonTimestamp) }