I have been working with some scripts to search for and delete stale AD Computers in our domain that have not logged in or been inactive for 180 days. I have tried both Search-ADAccount and Get-ADComputer for the initial search and I have noticed an interesting discrepancy. For some reason when searching with
Get-ADAccount -AccountInactive -TimeSpan 180.00:00:00
the report does not seem to go back exactly 180 days. It is closer to 196. Using
Get-ADComputer -Filter {lastLogonTimestamp -lt $lastLogon}
(with $lastLogon = (Get-Date).adddays(-180).ToFileTime()) it does seem to return the exact range.
Does anyone know what might account for this?