Welcome, guest | Sign In | My Account | Store | Cart
import os
import sys
import time
import subprocess
import active_directory

def set_perms(username):
    return subprocess.Popen(['fileacl', r'd:\users\%s' % username, '/S', r'%s:F' % username,
                             '/REPLACE', '/PROTECT'], stderr=subprocess.PIPE, stdout=subprocess.PIPE).communicate()

def get_users():
    return [str(user.cn) for user in active_directory.search ("objectCategory='Person'", "objectClass='User'")]

if __name__ == '__main__':
    while True:
        logfile = open('userperms_log.txt', 'a')
        logfile.write('\n\n\n' + time.ctime(time.time()) + '\n')
        sys.stdout = logfile
        for user in get_users():
            results = '\n'.join(list(set_perms(user)))
            if 'Error Bad trustee' in results:
                print results, '\n'
        logfile.close()
        time.sleep(5)

Diff to Previous Revision

--- revision 7 2009-10-24 14:35:35
+++ revision 8 2010-04-13 14:03:01
@@ -1,8 +1,8 @@
+import os
+import sys
+import time
+import subprocess
 import active_directory
-import subprocess
-import os
-import time
-import sys
 
 def set_perms(username):
     return subprocess.Popen(['fileacl', r'd:\users\%s' % username, '/S', r'%s:F' % username,

History