User's last logon date/time

  • Thread starter Thread starter Greg Garcia
  • Start date Start date
G

Greg Garcia

Is there a way to find out the users last logon date/time
or if the user is currently active.
 
I have a tool, that displays lastLogon attribute of a user object. lastlogon
attribute isn't replicated among DC's so you basically have to query each DC
in domain to get a proper value.

The tool is written with C# in .NET framework 1.1, so you need .NET
framework 1.1 to run this tool (you can get it from Windows Update).

Download Link (executables only) :
http://ladava.com/faq/uploads/ADInactiveObjects.zip
Download Link (source code):
http://ladava.com/faq/uploads/ADInactiveObjects_src.zip

As for currently active users, there is no easy way to find out who is
logged on to domain. One way would be to see the sessions entries in
Computer Management snapin under Shares. Another way would be by using
cconnect tool which is used for limiting concurrent logons, but it keeps a
track of who is currently logged on. Maybe others have different solution.

--
Regards

Matjaz Ladava, MCSE (NT4 & 2000), MVP
(e-mail address removed)
http://ladava.com
 
Currently logged on is tougher.
First we have to define logged on. Do you want all users who have an
interactive logon (as in logged on to a console) or all who have any
resources open, maybe via a network handle (such would be the case if the
user was logged on to a machine outside of the domain but accessing
\\someserver\someshare and had supplied credentials).

One could walk across the whole domain with WMI. If you were to say what
machines you wanted to check, you could then check each one via WMI for
users currently accessing resources on the server. Maybe the best way would
be to dump all computer accounts in the domain, then search each of them
with WMI.

I don't have sample code, never tried to do this. It shouldn't be hard to
write though, but might take a while to run if you have a large environment.

~Eric


--
Eric Fleischman [MSFT]
Directory Services
This posting is provided "AS IS" with no warranties, and confers no rights
 
Back
Top