Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pyad
- from pyad import *
- pyad.set_defaults(ldap_server="xxx.com", username="xxxtest", password="xxx@123")
- ou = pyad.adcontainer.ADContainer.from_dn("OU=TestOU,DC=xxx,DC=com")
- new_user = pyad.aduser.ADUser.create("Python", ou, password="abc@123")
- print("User Created Successfully")
- user = pyad.aduser.ADUser.from_cn("Python")
- user.update_attribute("givenName", "PYTHON")
- user.update_attribute("displayName","PYTHON-NEW")
- user.update_attribute("mail","python@python.org")
- user.update_attribute("st","XXX")
- user.update_attribute("initials","py")
- **user.udpate_attribute("sn","p")**
- user.update_attribute("telephonenumber","9176665636")
- user.force_pwd_change_on_login()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement