Use
string name = new System.Security.Principal.WindowsPrincipal(System.Security.Principal.WindowsIdentity.GetCurrent()).Identity.Name;
or
string name = System.Environment.UserName
or
string name = Environment.GetEnvironmentVariable("USERNAME");
or
string name = System.Security.Principal.WindowsIdentity.GetCurrent().Name;