List stale Active Directory computer accounts using Windows PowerShell
I was trying to identify computer accounts that had not logged in within the last 6 months. To do that, I used theĀ get-adcomputer PowerShell cmd-let.
get-adcomputer -properties lastLogonDate -filter * | where { $_.lastLogonDate -lt (get-date).addmonths(-6) } | FT Name,LastLogonDate > c:\test.txt
Tags: Active Directory, PowerShell