I’m trying to take Active Directory LastLogonTimeStamp and display the time difference from the current date. In the end, I want to display in days since the account was used.
This is what I tried but the numbers are wrong
$Last = Get-ADUser -Identity username -Properties LastLogonTimeStamp| select LastLogonTimeStamp -ExpandProperty LastLogonTimeStamp
$current = Get-Date
New-TimeSpan -start $current -end $last