Home All Groups Group Topic Archive Search About

Reading logon/logoff datetime

Author
19 Sep 2006 1:20 PM
Robert Scheer
Hi.

I need to write a service that writes to a database the time of the
logon and logoff of the users. Our users logs on Active Directory and
some can also log as local administrators. The majority of the
workstations are Windows 2000 and some are Windows XP. I am reading
about WMI but have found some limitations when reading the WMI
structures, mainly with Windows 2000.

What is the best way to read logon/logoff information in this scenario?

Thanks,
Robert Scheer

Author
19 Sep 2006 3:12 PM
ThunderMusic
if you use .NET 2.0, you can use the Microsoft.Win32.SystemEvents class and
register (and don't forget to unregister, because it's a static event) it's
SessionSwitch event.

http://msdn2.microsoft.com/en-us/library/microsoft.win32.systemevents.sessionswitch.aspx

I hope it helps

ThunderMusic

Show quoteHide quote
"Robert Scheer" <rbsch***@my-deja.com> wrote in message
news:1158672054.562099.232250@b28g2000cwb.googlegroups.com...
> Hi.
>
> I need to write a service that writes to a database the time of the
> logon and logoff of the users. Our users logs on Active Directory and
> some can also log as local administrators. The majority of the
> workstations are Windows 2000 and some are Windows XP. I am reading
> about WMI but have found some limitations when reading the WMI
> structures, mainly with Windows 2000.
>
> What is the best way to read logon/logoff information in this scenario?
>
> Thanks,
> Robert Scheer
>
Author
19 Sep 2006 8:48 PM
GhostInAK
Hello Robert,
The best way is to set up the domain accounts to cause an audit event on
logon/logoff.  This would write an entry to the NT Event Log whenever someone
logs on or off.

-Boo

Show quoteHide quote
> Hi.
>
> I need to write a service that writes to a database the time of the
> logon and logoff of the users. Our users logs on Active Directory and
> some can also log as local administrators. The majority of the
> workstations are Windows 2000 and some are Windows XP. I am reading
> about WMI but have found some limitations when reading the WMI
> structures, mainly with Windows 2000.
>
> What is the best way to read logon/logoff information in this
> scenario?
>
> Thanks,
> Robert Scheer