I’ve been trying out some things with Powershell and wanted to share this.
Active Directory is a great thing, but more often than we like to admit, it tends to become … messy.
So as a small cleanup exercise, here’s how you’d find “zombie” computers in Active Directory using PowerShell:
Get-ADComputer -filter * -properties * | Where-Object {$_.whenChanged -lt $((Get-Date).AddDays(-180))} | Select-Object CN, whenChanged
There you go. After this you’ll have a very nice list of computers that have not contacted Active Directory domain in 180 days or more.
Happy cleaning!