Re: How list all current logon NT domain users?

From: Chuck Chopp (ChuckChopp_at_rtfmcsi.com)
Date: 07/19/04


Date: Mon, 19 Jul 2004 09:15:45 -0400

hooway wrote:

> Sorry not use exact term to describe my problem.
>
> I searched the MSDN, and find that NetUserEnum() can return the user's
> last logon time, but not give the logoff time.
>
> Do you know any other way to get the logoff time, or know all user's
> current state: logon or logoff?

Unless you load some sort of software program on every single workstation in
the domain it is going to be impossible to obtain this information. In a NT
style domain or in AD, there's not continuous connectin to a server that is
required to exist while the user remains logged on to a workstation or TS
session. What this means is that once a user authenticates to the domain,
the domain controllers have no further requirement to know if that user is
still logged on to a workstation using the primary logon token that a domain
controller created for the user containing all of the access tokens
identifying that user, their logon mode and the groups to which they belong.
  Combine this with other issues, such as the same user account may be
logged on simultaneously on multiple workstations and/or TS sessions and
that there's no requirement for cleanly logging off or for reporting back to
a domain controller when the user does log off and the problem is even
further compounded.

The best solution to this problem that I've seen is where you load an
"agent" on every single workstation, member server and domain controller.
This "agent" is just a program that captures logon and logoff information
for every single console session and TS session on each system that it is
running on and forwards that information to a central database that can be
queried. This allows you to obtain current logon information as well as
historical logon/logoff information for all users on all workstations,
termianl servers, member servers and domain controllers across your entire
domain.

Lacking that sort of agent and centralized database of logon/logoff
information, you could run a different sort of agent that you could talk to
on any given workstation to enumerate what users are logged on to the
workstation at any given moment in time, but you'd still have to be loading
an agent on all systems and would still have to query each individual
workstation. If a remote system has terminal services enabled on it then
the task is easy as you can use the WTS*() Win32 API functions to get the
information w/o loading a special agent on the remote system. However, this
doesn't get you information for WinNT v4.0 workstation/server, nor does it
get you information for Win2K Pro or Win2K servers w/o TS enabled. It will
get you information for all WinXP & Win2K3 systems, though.

HTH,

Chuck

-- 
Chuck Chopp
ChuckChopp (at) rtfmcsi (dot) com http://www.rtfmcsi.com
RTFM Consulting Services Inc.     864 801 2795 voice & voicemail
103 Autumn Hill Road              864 801 2774 fax
Greer, SC  29651
Do not send me unsolicited commercial email.


Relevant Pages

  • Re: Daily Server Report (Critical Errors, Event ID: 537)
    ... Also, Logon type of 3 is a network logon, this is considered a ... Does this issue happen on client workstation or server? ... Does your server and all clients' workstation work well now? ... issue in your Network? ...
    (microsoft.public.windows.server.sbs)
  • Re: Daily Server Report (Critical Errors, Event ID: 537)
    ... Also, Logon type of 3 is a network logon, this is considered a ... Does this issue happen on client workstation or server? ... Does your server and all clients' workstation work well now? ... issue in your Network? ...
    (microsoft.public.windows.server.sbs)
  • Re: Users cannot access remote web workplace without admin access
    ... RWW site logon issue ... When we create the user accounts by using the SBS add users ... workstation through the RWW-RDP connection? ... For the RDP access issue, it could be an expected behavior. ...
    (microsoft.public.windows.server.sbs)
  • Re: Event ID 539 & 529 in large numbers - from what?
    ... When I get an account locking out without obvious cause, I just go in and delete all the saved passwords. ... Both the username and the workstation name are legitimate user/workstation on the network. ... Logon Failure: ... Caller User Name: - ...
    (microsoft.public.windows.server.sbs)
  • Re: Record User Logon/Logoff with Computer Name + Username
    ... the templates on Win2000 Servers. ... only give me the username that logged on and the time of initial logon. ... Incoming Computer Name, Logoff Time. ... occurs virtually simultaneously with a logon when you compare ticket ids). ...
    (microsoft.public.win2000.security)