mark hammond nkpmuffqskippinetcomau since windows 2000 sometimes better try manage users via activedirectory one excellent reason vb etc samples found make life easier little code ive used create users via ad im afraid need find add ou references likely another property accepts multiple values cut larger project stuff may missing stuff may complicated necessary attempt work across entire global catalog rather single domain someone else help adding ou via win32net probably stick cheers mark win32com import adsi win32comadsiadsicon import ntsecuritycon import win32netcon import win32con import def getwellknowncontainerdnguid domain domain domain domain suitable sticking path dse openobjectldapsrootdse domain adsiiid_iads dnc dsegetdefaultnamingcontext bind_string ldaps domain guid dnc dirobject openobjectbind_string open container return dirobjectgetdistinguishedname def createdomainuserdirobject cn domain samacctnamenone description user_description creates user essential properties explicitly set cn samaccounttype optional properties set idirectoryobject new user object dirobject none get default users folder dn getwellknowncontainerdnguid_users_container_a domain dirobject openobjectldap dn adsiiid_idirectoryobject dirobject dirobjectqueryinterfaceadsiiid_idirectoryobject samacctname samacctname cn assert lensamacctname 20 samaccountname bigger 20 characters attrinfo objectclass ads_attr_update adstype_case_ignore_string user samaccountname ads_attr_update adstype_case_ignore_string samacctname description ads_attr_update adstype_case_ignore_string description user dirobjectcreatedsobjectcncn attrinfo enabledomainaccountuser return userqueryinterfaceadsiiid_iadsuser def enabledomainaccountuser_ob ensure user account enabled user_ob user_obqueryinterfaceadsiiid_iads try user_obputpwdlastset 1 user_obsetinfo except pythoncomcom_error details appears fail 2003server loggerwarningfailed set pwdlastset details try seems fail complicating things little httpgroupsgooglecomaugroupmicrosoftpublicadsigeneralbrowse_frmt hreadbe113549cb62ebbea4cf4de3756367ad indicates useraccountcontrol isnt even used later versions windows says want unlock locked account set lockouttime 0 mask default bits uf_passwd_notreqd fails win2003 new_val user_obgetuseraccountcontrol ads_uf_dont_expire_passwd new_val uf_accountdisable user_obputuseraccountcontrol new_val user_obsetinfo except pythoncomcom_error details appears fail 2003server loggerwarningfailed set useraccountcontrol details def openobjectpath iid adsiiid_iads return adsiadsopenobjectpath none none usernamepassword ads_secure_authentication flags iid original message necrjiabt57imetonepythonorg mailtopythonwin32 xddnvjgpythonorg behalf ian john newton sent wednesday 2 april 2008 1152 pm kpitckaew45pythonorg subject pythonwin32 adding users specific organization unit domain hi need take text file list users groups organization units add users domain currently server win 2k also need win2003 used batchusercreatepy ch 16 mark hammonds python programming win32 added win32netnetgroupadduserservername group username function add user particular security group works fine cant seem find way change organizational unit users get added default container users security group domain users com method add specific organizational unit thanks advance help may able provide regards ian newton _______________________________________________ pythonwin32 mailing list kpitckaew45pythonorg httpmailpythonorgmailmanlistinfopythonwin32 _______________________________________________ pythonwin32 mailing list kpitckaew45pythonorg httpmailpythonorgmailmanlistinfopythonwin32 thu 07 aug 2008 171803 1100 pythonwin32 adding users specific organization unit domain