You can easily retrieve information about the current user by means of a few properties of the Environment class. The Environment.UserName returns the name of the user; the Environment.UserInteractive property returns True if the user is an interactive user; the UserDomainName returns the user’s domain name:
Console.WriteLine("UserName: {0}", Environment.UserName)Console.WriteLine("User is interactive: {0}", Environment.UserInteractive)Console.WriteLine("UserDomainName: {0}", Environment.UserDomainName)