Hi all,
I want to write a window service that send the email as soon as the user will logged in into the system(Computer).
I want to know the user and the time i.e. at what time he/she logs in.
With the help of system.security,principal i get the current user but how to get the loggin time.
Pease help!
Loading

VulpesPosted May 13, 2011, 10:45 AM
Vijay YadavPosted May 21, 2011, 8:40 AM
VulpesPosted May 21, 2011, 8:28 AM
Vijay YadavPosted May 21, 2011, 7:10 AM
With the help of Logontype=10, its working.
It is use for both remote and interactive.
Anyway thanks a lot!
VulpesPosted May 21, 2011, 6:21 AM
var mos = new ManagementObjectSearcher("SELECT * FROM win32_LogonSession ");
as evidently there are no sessions with a LogonType of 2 ('interactive') running on your machine.
See here(http://msdn.microsoft.com/en-us/library/aa394189(VS.85).aspx) for the types of sessions which are supported if you want to do your own filtering.
Sam HobbsPosted May 21, 2011, 3:45 AM
Vijay YadavPosted May 21, 2011, 3:00 AM
Thanks for your reply!
@Vulpes - I tried this way but it is not going in 1st foreach loop when i debug. Hence no result.
@Suthish - Yes, you are right.
@Sam - There is in-built service but i need to create one.
Sorry!!! for late reply guys.
Sam HobbsPosted May 13, 2011, 7:05 PM
Suthish NairPosted May 13, 2011, 12:49 PM
Vijay YadavPosted May 13, 2011, 8:35 AM
It's working but i want the user name of the system, it is giving LogonId as "NT AUTHORITY\SYSTEM". I have attached file please see it!
VulpesPosted May 12, 2011, 9:13 AM