Can I query for what times a user authenticated against AD using DSQUERY?

Posted on 2008-09-29
Last Modified: 2013-12-24
Can I query for what times a user authenticated against AD using DSQUERY?  I'm running in mixed mode.
Question by:instaIT
  • 2

Expert Comment

ID: 22597023
dsquery * "cn=Bill Gates,ou=test,dc=microdomain,dc=com" -scope base -attr
LVL 70

Expert Comment

by:Chris Dent
ID: 22597067

That won't be entirely accurate. The attribute is described here:

And discussed here:

Which tells us that the attribute above may be off by as much as 14 days.

So it's great, depending on how accurate you need / want to be.


Author Comment

ID: 22597078
Is there a way to see the history over a period of time rather than just the last logon stamp?
LVL 70

Accepted Solution

Chris Dent earned 500 total points
ID: 22597149

Nope, both lastLogon and lastLogonTimeStamp are single value attributes.

Basically, if you want a history you'd have to write something to maintain it, perhaps something through a logon script?

It would be possible to do it on the server side, but for accuracy you'll need the lastLogon attribute. The problem is, that one isn't replicated, which means you have to check every DC in your environment to get the actual value. That would be painful if it were required of a regular basis.


Featured Post

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
This script can help you clean up your user profile database by comparing profiles to Active Directory users in a particular OU, and removing the profiles that don't match.
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles to another domain controller. Log onto the new domain controller with a user account t…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now