Quoting Mark Hammond <[EMAIL PROTECTED]>: > It looks as though the SHARE_INFO_502 supports this via the > sh502_security_descriptor attribute. Presumably this can be used with > NetShareGetInfo and NetShareSetInfo. > > Mark.
Mark, would you write an example of this using SHARE_INFO_502? I'm not an experienced win32 programmer... if that's not obvious already :) Here is what I've done so far: This code gets the shares and writes them into a list that is then pickled... this is my share info that I back up each week: # Get a list of shares that *WE* have defined # Excluding the builtin Windows Shares. my_shares = [] all_shares = win32net.NetShareEnum(server, 0) for share in all_shares[0]: #print share for name, value in share.iteritems(): if '$' not in value: my_shares.append(value) # Dump the my_shares list into a pickle. fd = file('shares.bin', 'wb') cPickle.dump(my_shares, fd) fd.close() This code recreates the shares based on the pickled share list... I only use this when reinstalling the server: # Extract the my_shares list from the pickle and recreate shares. fd = file('shares.bin', 'rb') my_shares = cPickle.load(fd) fd.close() my_share_info = [] for share in my_shares: my_share_info.append(win32net.NetShareGetInfo(server, share, 2)) for share_info in my_share_info: try: win32net.NetShareAdd(server, 2, share_info) except Exception, e: print e This restores everything except share permissions... would you show me how to incorporate the SHARE_INFO_502 into this? If so, it'd be a big help. Thanks, Brad > > > -----Original Message----- > > From: [EMAIL PROTECTED] > > [mailto:[EMAIL PROTECTED] Behalf Of Brad Tilley > > Sent: Tuesday, 31 January 2006 9:11 AM > > To: python-win32@python.org > > Subject: [python-win32] Extracting share permissions > > > > > > > > Hi there, > > > > I've googled around a bit but I can't find an easy, > > straight-forward way of > > doing this in Python. Here's my situation: I want to be able to > > extract 'share > > permissions' (not file system permissions) from shares and then > > reapply them. > > We have a large file server that occasionally has to be rebuilt. > > I'm able to > > recreate all of the share information _except_ 'share > > permissions' any tips on > > doing this will be greatly appreciated!!! > > > > I can provide more details if needed. > > > > Thanks, > > Brad > > _______________________________________________ > > Python-win32 mailing list > > Python-win32@python.org > > http://mail.python.org/mailman/listinfo/python-win32 > > > > _______________________________________________ Python-win32 mailing list Python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32