>>>Hi All, does anyone know how to get the owner of a file resident on a Windows 2003 server ?
>>>
>>>I've tried using the FileInfo / FileSecurity / IdentityReference classes and invoking the GetOwner() method but it always returns "Builtin\Administrators"
>>
>>Why do you think what it is returning is wrong? I just tested a few of them using those classes and it returned the correct owner. I verified it by going into Explorer, right-clicking on the file and selecting Properties > Security > Advanced > Owner
>>
>>
>>// using System.Security.AccessControl;
>>// using System.Security.Principal;
>>
>>var fileInfo = new FileInfo (@"C:\Windows\System32\capiprovider.dll");
>>var fileAccessControl = fileInfo.GetAccessControl();
>>var identityReference = fileAccessControl.GetOwner(typeof(NTAccount));
>>// Contains file owner
>>// identityReference.Value
>>
>
>Hi Paul, I created a couple of txt files logged in as me, I ran the prog and it returned Builtin\Administrators - I checked using Explorer props and it's the same info - guess it might be permissions ?
There is a nice article here:
http://msdn.microsoft.com/en-us/magazine/cc163885.aspxThis example returns the same as you are seeing:
http://codeidol.com/csharp/csharpckbk2/Security/Obtaining-Security-Audit-Information/
.·*´¨)
.·`TCH
(..·*
010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"