I am trying to determine the user who created a particular file like so:
string path = "C:\\TheFile.dat";
string user = System.IO.File.GetAccessControl(path).GetOwner(typeof(System.Security.Principal.NTAccount)).ToString();
When the file was created by a user who was not a member of the Administrators user group, the user's username was returned. However, when the file was created by someone who was a member of the Administrators user group, "Domain\Administrators" was returned.
Can anyone think why this might happen and how I can ensure that an actual user name is returned?
Thanks.