Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

LastLogoff Always Empty!

290 views
Skip to first unread message

Alan Kidner

unread,
Aug 27, 2003, 7:29:00 PM8/27/03
to
We are using Windows Server 2003 and Active Directory. I
want to find out when users last logged off but the
LastLogoff property seems to be always empty!
LastLogon seems to record the appropriate information
okay but LastLogoff does not. What can be done about
this?

Best regards,

Alan.

Matjaz Ladava [MVP]

unread,
Aug 28, 2003, 3:39:39 AM8/28/03
to
You are correct LastLogoff is not populated by default. Another warning
about using lastLogon/lastLogoff attribute. This attributes are not
replicated among DC's so you need to query all DC's to get the right value.
Windows server has lastLogonTimestamp attribute (but no lastLogoffTimestamp)
which is replicated and holds the right information (for logon).

--
Regards

Matjaz Ladava, MCSE (NT4 & 2000), Windows MVP
mat...@ladava.com
http://ladava.com

"Alan Kidner" <alan....@nwarks-hinckley.ac.uk> wrote in message
news:06d001c36cf2$fe59cf90$a301...@phx.gbl...

Alan Kidner

unread,
Aug 28, 2003, 7:44:32 AM8/28/03
to
Thanks for your response. You say, "LastLogoff is not
populated by default", but is it possible to make Windows
Server populate it? If so can you tell me how this is
done? Alternatively, can you tell me of another means of
obtaining a list of users who are currently logged on? I
am using Visual Basic 6.0.

Best wishes, Alan.

>.
>

Alan Kidner

unread,
Aug 28, 2003, 7:44:43 AM8/28/03
to
Thanks for your response. You say, "LastLogoff is not
populated by default", but is it possible to make Windows
Server populate it? If so can you tell me how this is
done? Alternatively, can you tell me of another means of
obtaining a list of users who are currently logged on? I
am using Visual Basic 6.0.

Best wishes, Alan.

>.
>

Joe Richards [MVP]

unread,
Aug 28, 2003, 11:38:05 PM8/28/03
to
There is no documented way that I am aware of to make the OS populate that attribute, there are several attributes like
that, basically put in for *future use*.

*Logged On* is a slipper concept in Windows. You can't really define it. It could be an interactive logon, it could be a
batch logon, it could be a service logon, it could be a runas logon, a network connection, etc. Basically when you logon
depending on how many servers you connect to and what kind of client and server mix you have you could have several
authentications right at logon. I could be on your network doing something with one ID and never logon interactively
with it, at that point am I logged on with it? How about a user who logs on then hibernates for a week, is she logged on
or not? The PC thinks so because when you fire it back up you are right at the same spot on the screen you were a week
ago...

The closest you can get in a domain or workgroup type of environment is to enumerate who has sessions at any given
machine. This is done by NetSessionEnum. If you want to find out who is logged on interactively at a machine, there are
ways of doing that as well. Check out www.sysinternals.com for methods they have found to do it though you won't find
much VB there, they are c++ guys as they are pretty serious.

--
Joe Richards
www.joeware.net

--

"Alan Kidner" <alan....@nwarks-hinckley.ac.uk> wrote in message news:042c01c36d59$c5d42f00$a001...@phx.gbl...

Alan Kidner

unread,
Aug 29, 2003, 1:29:47 PM8/29/03
to
Thank you both for your help. I found some sample code
using NetSessionEnum at www.tek-tips.com and have
experimented with it in my test environment today. I had
tested NetWkstaUserEnum before but going back to what Joe
said about what is a logon/logoff, this returned user
information even after a Windows XP user logoff. In
comparison NetSessionEnum recognised such a logoff within
a matter of seconds. However, logging on an XP
workstation and joining the domain was not picked up
unless the user had a drive mapping to a server volume or
accessed the server in some way. This should always be
the case in my situation and I am confident that I can
now finish writing my utility. Thank you again, I am
most grateful.

Best regards, Alan.

>-----Original Message-----
>Besides what Joe suguested, I woud add, that it could be
possible, to create
>a script and use it as a user logoff script (trough
GPO), which would set
>that attribute, but you would have to delegate
permission to the user to
>populate this field.


>
>--
>Regards
>
>Matjaz Ladava, MCSE (NT4 & 2000), Windows MVP
>mat...@ladava.com
>http://ladava.com
>
>

>"Joe Richards [MVP]" <humore...@hotmail.com> wrote in
message
>news:%23KGD37d...@TK2MSFTNGP09.phx.gbl...

>.
>

0 new messages