The following comand will query Active Directory for users that haven loged on in a certain amount of time.

dsquery computer -inactive 8 -limit 0

The above comands looks for computer accounts that have been inactive for 8 weeks.

If the accounts are definatly not in use then the following command can be used to clear them from Active Dierctory.

dsquery computer -inactive 8 -limit 0 | dsrm -noprompt