Report logged on user in log file
https://git.scicore.unibas.ch/vamp/auto-tx/blob/master/ATxCommon/SystemChecks.cs#L105
If this turns out to be difficult (or slow) through the ManagmentObject
queries we could consider checking for existing explorer.exe
processes, e.g. like this:
foreach (System.Management.ManagementObject Process in Processes.Get())
{
if (Process["ExecutablePath"] != null &&
System.IO.Path.GetFileName(Process["ExecutablePath"].ToString()).ToLower() == "explorer.exe" )
{
string[] OwnerInfo = new string[2];
Process.InvokeMethod("GetOwner", (object[])OwnerInfo);
Console.WriteLine(string.Format("Windows Logged-in Interactive UserName={0}", OwnerInfo[0]));
break;
}
}