Hi, I'm trying to write a little python prog to list the groups and their members that have access to a directory or file on a network device.
I can get info for a local file (on C drive) but this doesn't seem to work on a network drive: I get teh following error ------------------------------- Traceback (most recent call last): File "C:\software\Python24\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py", line 310, in RunScript exec codeObject in __main__.__dict__ File "C:\projects\access_groups\AccessList.py", line 36, in ? accounts = getAccountList(domain, sidList) File "C:\projects\access_groups\AccessList.py", line 20, in getAccountList accounts = [ win32security.LookupAccountSid(domain,x) for x in sidList] error: (1332, 'LookupAccountSid', 'No mapping between account names and security IDs was done.') ------------------------------ I'm not sure what this means. Can anyone enlighten me or point me in the right direction. thanks Peter .............. Here is the code that I have managed to write so far: import win32security, sys from optparse import OptionParser def getAceList(filename): secDes = win32security.GetNamedSecurityInfo(filename, \ win32security.SE_FILE_OBJECT, \ win32security.DACL_SECURITY_INFORMATION \ | win32security.GROUP_SECURITY_INFORMATION \ | win32security.OWNER_SECURITY_INFORMATION) dacl = secDes.GetSecurityDescriptorDacl() aceList = [] for i in range(dacl.GetAceCount()): aceList.append(dacl.GetAce(i)) return aceList def getAccountList(domain, sidList): accounts = [ win32security.LookupAccountSid(domain,x) for x in sidList] return accounts if __name__ == "__main__": parser = OptionParser() parser.add_option("-f", "--file", dest='filename', help="list access names and groups for FILE", metavar="FILE") parser.add_option("-d", "--domain", dest='domain', help="domain to use for the security info", metavar="DOMAIN") (options, args) = parser.parse_args() filename = options.filename domain = options.domain aceList = getAceList(filename) sidList = [x[2] for x in aceList] accounts = getAccountList(domain, sidList) for account in accounts: print str(account) _______________________________________________ Python-win32 mailing list Python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32