Link to home
Start Free TrialLog in
Avatar of SwamyN
SwamyN

asked on

Using VB6 or dot net, how do i obtain windows login details?

I need to find out how many times and WHEN  a user has logged in or out after booting up a PC.

If possible, I also need to find out when and how many times after boot up, a PC was put into hibernation mode
Avatar of sreerajrs
sreerajrs

In .Net You can easily find out windows logon information using WMI(Windows Management Instrumentation).  For that you need to reference "System.Management" namespace.
You can find a sample code in c# for getting Windows logon using wmi Here
http://alperguc.blogspot.com/2008/11/c-read-windows-logon-user-name-in-wmi.html
You can  use the wmi code creator tool for creating wmi codes. Have a look http://www.microsoft.com/downloads/details.aspx?familyid=2cc30a64-ea15-4661-8da4-55bbc145c30e&displaylang=en
Avatar of SwamyN

ASKER

i got the sample code running, and it gives me the username.....is there a parameter i can pass to it that would return login and logout times of a user?
Hello Swamy ,
You can download WMI Toolkit from microsoft and you can find out all the methods  there .  please try that way.
warm regards
sree
You need to download WMI SDK also
ASKER CERTIFIED SOLUTION
Avatar of sreerajrs
sreerajrs

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
the above code snippet will give you the log on time