Get Logged In User while Impersonate or Run as Admin

Sometimes when a program is run as Administrator, using the System.Security.Principal.WindowsIdentity.GetCurrent().Name will return always System or NT Authority\System. This happens while running the exe under windows service or by Installer class in the windows application. The below code will solve this issue. Code Snippet public static string GetParentUser(int pid)         {             string parentUserAccount = null;             string... Continue Reading →

Create a website or blog at WordPress.com

Up ↑