File Owner Info

(imported topic written by cj6591)

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.

Please help!

(imported comment written by SystemAdmin)

If the file was C:\blabla.txt, try…

owner of security descriptor of file “C:\blabla.txt”

-Paul

(imported comment written by cj6591)

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.

(imported comment written by SystemAdmin)

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?

Paul

(imported comment written by cj6591)

I am logging in with AD credentials.

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.

(imported comment written by SystemAdmin)

I use a task which searches for PSTs using DIR and inputs it into a text file. It runs like this:

runhidden {pathname of system folder}\cmd.exe /C dir /s /b c:*.PST >"{pathname of parent folder of regapp “besclient.exe”}\searchresults_PST.txt"

You could try adding /q to it and seeing if that works. Just change what file you apply this to.

(imported comment written by cj6591)

Thanks!

I did actually try that and the /b option removes all the extra data from the dir command output … I wish that worked :slight_smile:

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.

(imported comment written by SystemAdmin)

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.

Which version of Windows are you using?

Paul

(imported comment written by cj6591)

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.

Thanks for sticking with this and with me!

  • Chris