[no subject]
hello to all i have been using this script to add users to my active directory structure i wise to make a loop in order for it to run for A large Number of Users can anyone give me some advice on the loop ?? import win32com,win32com.client def add_acct(location,account): ad_obj=win32com.client.GetObject(location) ad_user=ad_obj.Create('user','cn='+user['login']) ad_user.Put('sAMAccountName',user['login']) ad_user.Put('userPrincipalName',user['login']+'@email.address.com') ad_user.Put('DisplayName',user['last']+' '+user['first']) #fullname ad_user.Put('givenName',user['first']) ad_user.Put('sn',user['last']) ad_user.Put('description','regular account') ad_user.Put('physicalDeliveryOfficeName','office 1') ad_user.Put('HomeDirectory',r'\\server1\ '[:-1]+user['login']) ad_user.Put('HomeDrive','H:') ad_user.SetInfo();ad_user.GetInfo() ad_user.LoginScript='login.bat' ad_user.AccountDisabled=0 ad_user.setpassword('the password') ad_user.Put('pwdLastSet',0) #-- force reset of password ad_user.SetInfo() location='LDAP://OU=sales,DC=shay,DC=com' user={'first':'shay','last':'smith','login':'shay123'} add_acct(location,user) location='LDAP://OU=sales,DC=shay,DC=com' user={'first':'ron','last':'smith','login':'ron1267'} add_acct(location,user) -- http://mail.python.org/mailman/listinfo/python-list
Re: python command not working
--- On Wed, 4/22/09, karlos barlos wrote: From: karlos barlos Subject: Re: python command not working To: "Ben Finney" Date: Wednesday, April 22, 2009, 3:05 AM look for envaroment variables__ in system menu__path_paste the python path in ___- done i recomend you add scripts too ... -- http://mail.python.org/mailman/listinfo/python-list
Re:
ok sorry TIM I just took some piece of code that ADDs users to AD import win32com,win32com.client def add_acct(location,account): ad_obj=win32com.client.GetObject(location) ad_user=ad_obj.Create('user','cn='+user['login']) ad_user.Put('sAMAccountName',user['login']) ad_user.Put('userPrincipalName',user['login']+'@email.address.com') ad_user.Put('DisplayName',user['last']+' '+user['first']) #fullname ad_user.Put('givenName',user['first']) ad_user.Put('sn',user['last']) ad_user.Put('description','regular account') ad_user.Put('physicalDeliveryOfficeName','office 1') ad_user.Put('HomeDirectory',r'\\server1\ '[:-1]+user['login']) ad_user.Put('HomeDrive','H:') ad_user.SetInfo();ad_user.GetInfo() ad_user.LoginScript='login.bat' ad_user.AccountDisabled=0 pas = raw_input("\nChoose PaSSword..:") ad_user.setpassword(pas) ad_user.Put('pwdLastSet',0) #-- force reset of password ad_user.SetInfo() very = raw_input("\nWhat OU To Place User...?:") location=("LDAP://ou=%s,dc=shay,dc=com" % very) name = raw_input("\nEnter The First Name...:") last = raw_input("\nEnter The Last Name:") log = raw_input("\nEnter LOGON na...@...:") user={'first':(name),'last':(last),'login':(log)} add_acct(location,user) I HAVE been playing around setting up input fields for the user to fill out im just having problems withe dom = raw_input("the domain name") ad_user.Put('userPrincipalName',user['login']+'@ [(dom]') can you point to a good ref ? PS i think this uses the com moudle -- http://mail.python.org/mailman/listinfo/python-list
[no subject]
hello to everybody... having problem withe this code : dom = raw_input("The Domain name..:") ad_user.Put('userPrincipalName',user['login']+'@(['dom']) but it wont change whay ? -- http://mail.python.org/mailman/listinfo/python-list
[no subject]
hello to everybody... having problem withe this code : dom = raw_input("The Domain name..:") ad_user.Put('userPrincipalName',user['login']+'@(['dom']) but it wont change whay ? -- http://mail.python.org/mailman/listinfo/python-list
[no subject]
hello to all !! given the code : elif choice == "3": print "all users list :" print"\n" import active_directory for user in active_directory.search ("objectCategory='Person'", "objectClass='User'"): print user "" that lists all active directory personal ... how can i pipe this into a csv file ?? or a text file ? do need to first make it txt and then csv?? -- http://mail.python.org/mailman/listinfo/python-list
Re:
--- On Sat, 4/18/09, Joe Riopel wrote: From: Joe Riopel Subject: Re: To: "karlos barlos" Cc: python-list@python.org Date: Saturday, April 18, 2009, 12:01 PM On Sat, Apr 18, 2009 at 12:56 PM, karlos barlos wrote: > LDAP://CN=bessy,OU=sales,DC=shay,DC=com > LDAP://CN=ron,OU=legal,DC=shay,DC=com > > to a text \ csv file ... > > can any one help ?? can some one give my an exmple on how to pipe the output into a csv. file ?? -- http://mail.python.org/mailman/listinfo/python-list
[no subject]
i have the following code : elif choice == "3": print "all users list :" print"\n" import active_directory for user in active_directory.search ("objectCategory='Person'", "objectClass='User'"): print user i want to write the output of the code ( LDAP://CN=bessy,OU=sales,DC=shay,DC=com LDAP://CN=ron,OU=legal,DC=shay,DC=com to a text \ csv file ... can any one help ?? -- http://mail.python.org/mailman/listinfo/python-list