Get file owner in Windows

T

Thibault Ketterer

Don't know if it's still usefull but

it seems that you have to get the sid from a "give sid function"

import win32security,pywintypes
try:
filo = win32security.GetFileSecurity(path,
win32security.OWNER_SECURITY_INFORMATION)
sid = filo.GetSecurityDescriptorOwner()
account, domain, typecode =
win32security.LookupAccountSid(None, sid)
except pywintypes.error,details:
account = domain = ""
errcode = details[0]
print "error acces:", path
print domain + u'\\' + account
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,045
Latest member
DRCM

Latest Threads

Top