How to find inactive computers in Active Directory and disable it?
dsquery computer -inactive 4 -limit 0 | dsmod computer -disabled yes
Where -inactive is quantity of weeks.
Also this search can be performed by Free PowerShell Commands for Active Directory from Quest:
Get-QADComputer -InactiveFor 30
Where 30 is quantity of days.