[2.0] Get user account that log to your PC.
Hi guys good day. How can I get users account that log to my pc? I tried it in WMI using win32_useraccount but there's no luck. I want to retrieve information such as user account and the last time she/he logon. Links and article will do.
Thanks in advance guys.
Re: [2.0] Get user account that log to your PC.
I'm not sure how to do that pragmatically, but you must enable the "Audit Logon Events"
Control Panel==>Administrative Tools==>Local Security settings==>Local Policies==>Audit Policy
Set the "Audit Logon Events" to success and optionally failure
now all you have to do is read the events from the Event Log and filter the category for "logon/logoff" events and search for the user name between the strings "User Name:" and "Domain:"
Re: [2.0] Get user account that log to your PC.
Thanks for the input mate. At least I see now on who log in my pc. My problem now is to get those information.
Re: [2.0] Get user account that log to your PC.
Re: [2.0] Get user account that log to your PC.
Thanks for the great link hack. But it's seems it gets only the current user log in your pc not all the user and there's no specific log time of each user.
Can it be done in c# to enable the audit logon events?
Re: [2.0] Get user account that log to your PC.
Well I am not sure about it, but have you tried looking into WMI class "Win32_UserAccount"??
There are 3 more similar WMI classes: Win32_UserDesktop, Win32_SystemUsers, Win32_UserInDomain
Re: [2.0] Get user account that log to your PC.
I have here a wmi code creator from microsoft and go through that classes but no luck.