There are two attributes you can key off of to solve this problem.
As mentioned before, there is the lastLogon attribute. Since this is not
replicated, it becomes less efficient to use, because you must construct
your query such that it asks each DC for the last logon for each computer
and then compares the values. There are many tools out there that do the
querying and comparison automatically, but because you're querying multiple
DCs, it can take awhile, especially if you have several DCs spread out over
a LAN.
A more efficient approach is to work from the pwdLastSet attribute.
Computer accounts that are actively on the domain will reset their password
with a domain controller every 30 days. (Note: that default 30 day value
can be configured to another value). The pwdLastSet attribute is
replicated, which makes it a simple query.
You may want to query for all computer accounts whose pwdLastSet value is
longer than say, 45 days, and review them for deletion. You may also want
to consider laptops or remote users that take their computes from their
domain for extended periods of time. We have some DSRAZOR for Windows
customers that automatically scan AD (scheduled job) on a nightly basis for
computer accounts with old passwords and automatically remove or disable
them. Some of our customers also place rules in the query to exclude
laptops, etc.
If you would like to see how you can do this with DSRAZOR than you can go to
our website here:
www.visualclick.com/?source=cleanupcomputers050407