ManagementObjectSearcher srch = new ManagementObjectSearcher("root\\CIMV2","select * from win32_useraccount"); foreach(ManagementObject mObj in srch.Get()) { textBox1.Text += mObj["name"]+Environment.NewLine; }
string userName = System.Security.Principal.WindowsIdentity.GetCurrent().Name; or userName = Environment.UserName;
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)