August 19, 2015 Darren

Remove stale computer accounts from Active Directory

Short one:

How to remove stale computer accounts from Active Directory.

Run Powershell on a Domain Controller

dsquery computer -inactive 8 -limit 0

-inactive x – this will find PCs that have been inactive for x weeks.
– limit x – Use this to list the amount of results you require (100 results is the default dsquery will use)
You can add >> c:\myfile.csv to export to .CSV