Sorry if this has been asked but I can’t find any reference to it …
How can I get the file owner information from a file reference?
I can produce it with a dir /q so I would assume that there is a bigfix file property that can report this but I can’t find any reference to it in the forums, support site or application docs.
basically I will have a file that contains a list of file references, full path and file name.
I then need to be able to parse that input file and obtain the owner information for each of those files.
I should be ok on the first part but the owner part is killing me.
That is close, I think I tired that one yesterday … it returns what appears to be the owner of the actual security descriptor … in this case, on a file that I created while logged in with my ID that command returns “builtin\administrator” … I need it to return my ID … like what you would see with a dir /q command.
Was the ID that you logged on as just a local account on that PC, or was it a domain account?
I tried using both a local account (with admin privs) as well as my domain account (also an admin). In both cases it returned my username that I used for both “dir /q” as well as relevance debugger.
If I look at the folder with dir /q, I do see the folder itself as “BUILTIN\Administrators”. Are you sure you’re looking at the files of the folder and not the folder’s owner?
I am pretty sure that I am using the correct command and referencing the correct object … it was an explicit “of file …” reference not a "file of folder … " reference.
when I do a dir /q I see the local domain account that created the file (in this case my ID) but the BigFix relevance as stated above returns the “BUILTIN\Administrator” reference.
I did actually try that and the /b option removes all the extra data from the dir command output … I wish that worked
I could just remove the /b reference and output ALL of the dir content to a file which would then capture the data and then parse the data to get just the lines and fields I want BUT I was hoping for a more elegant solution in which I would just do a dir /b option like you mentioned and then read that file and grab the owner info assiciated with that file.
Odd. Wish I could reproduce this one. I can create a folder (elevated) which has “BUILTIN\Administrator” as the owner and I see the same if I copy a file in there elevated as well. But on my PC both dir/q and the BES debugger show “BUILTIN\Administrator” for the files and folder.
If I open the folder for users-modify and copy a file, then I see my own username – but both in the BES debugger and dir/q.
I think you found the problem … the OS (or machine function).
I was testing on a 2008 server, I even created a new file to make sure I wasn’t mistakenly using a file that I didn’t own. No matter what I do on the server it returns:
Q: owner of security descriptor of file “C:\temp\test.txt”
A: BUILTIN\Administrators
T: 9.983 ms
I: singular security identifier
When I do the same thing from my desktop (windows 7) I get the expected/proper response:
Q: owner of security descriptor of file “C:\temp\test.txt”
A: <My ID>
T: 8.888 ms
Thanks!
Now I can go on with my task.
I’ll have to remember to test on my workstation and not on the server … especially when the results are not coming back as expected.