I want to get the owner of the file using the code below
File.GetAccessControl(filename).GetOwner(typeof(SecurityIdentifier)).Translate(typeof(NTAccount))
However, it gives me BUILTIN \ Administrators as the owner, but I can see the owner of Domain \ MyUserName in the file explorer.
Why is this happening and how can this be fixed?
Edit: This link explains what is happening. This applies to files created by users in the Administrator group, and how Windows processes the owner of these files.
source share