Gibt den Aktuellen Benutzernamen aus. (string)
using System.Security.Principal;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
WindowsIdentity identity = WindowsIdentity.GetCurrent();
WindowsPrincipal principal = new WindowsPrincipal (identity);
Console.WriteLine(principal.Identity.Name);
}
}
}
2 Kommentare zum Snippet