Computer Logon time


David Phelan

Hi, hope someone can help with this.

We are trying to do some cleanup in our active directory. We would like to
be able to automate the process as best we can. Mainly we are trying to
clean up old computer objects for PCs that we no longer have but are still
in our system.

I found a code snippet which goes through the computer list in AD and
generates a list of machines that have lastLogon dates older then 1 year
which works just fine. The problem is that there are some machines in the
list that we know are in daily use. Their logon dates are over a year old
but the machines are logged into every day. Other active machines in the
system have null login dates.

We checked a couple of the machines in question to make sure that machine
names hadn't been changed and that they had been rebooted and relogged on
to, but the lastlogon date does not change.

Anyone have any idea why this would be true or how to force the logon date
to update when the machine connects to the network?





Hi Dave,

do you have more than one dc??
if YES, then you must query all dc, to get the right answer about the logon


David Phelan

Thanks for the reply.

We have 3 DCs on the network and I am querying them all.

Any other thoughts?



Cary Shultz [A.D. MVP]


While this is not an 'automated' way to doing what you are looking to do I
might suggest that you take a look at 'oldcmp' from
in the Free C++ WIN32 section. It is a great tool for what you want.



Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question