I am running a Windows service under the Administrator account and I would like to find out who is the currently logged in user. It will be different from the account the service is currently running under. Is there any easy way to get it from C#?
Those do not appear to work:
System.Security.Principal.WindowsIdentity.GetCurrent()
System.Environment.UserName
I am interested who is currently logged in with a console session.
I am not interested in other remote sessions, since this is not my case scenario.