How do I get the current logged in Windows user? my problem: i'm running a process with administrator privileges and all these:
Console.WriteLine(System.Security.Principal.WindowsIdentity.GetCurrent().Name);
Console.WriteLine(Environment.UserName);
Console.WriteLine(System.Security.Principal.WindowsIdentity.GetCurrent().User); //GUID
Console.WriteLine(Environment.GetEnvironmentVariable("USERNAME"));
...tries give me back the current user who runs the process, in my case Administrator - but i'd like to have the current user who is logged in.
Any ideas or suggestions?