Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2008-09-29
4
Medium Priority
?
333 Views
Last Modified: 2013-12-24
Can I query for what times a user authenticated against AD using DSQUERY?  I'm running in mixed mode.
0
Comment
Question by:instaIT
  • 2
4 Comments
 
LVL 3

Expert Comment

by:R_Janssen
ID: 22597023
Yep,
Example:
dsquery * "cn=Bill Gates,ou=test,dc=microdomain,dc=com" -scope base -attr
lastLogonTimestamp
 
0
 
LVL 71

Expert Comment

by:Chris Dent
ID: 22597067

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

http://msdn.microsoft.com/en-us/library/ms676824.aspx

And discussed here:

http://www.microsoft.com/technet/scriptcenter/topics/win2003/lastlogon.mspx

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.

Chris
0
 
LVL 1

Author Comment

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

Accepted Solution

by:
Chris Dent earned 2000 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.

Chris
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

What we learned in Webroot's webinar on multi-vector protection.
It’s time for spooky stories and consuming way too much sugar, including the many treats we’ve whipped for you in the world of tech. Check it out!
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

886 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