Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. import pyad
  2. from pyad import *
  3. pyad.set_defaults(ldap_server="xxx.com", username="xxxtest", password="xxx@123")
  4. ou = pyad.adcontainer.ADContainer.from_dn("OU=TestOU,DC=xxx,DC=com")
  5. new_user = pyad.aduser.ADUser.create("Python", ou, password="abc@123")
  6. print("User Created Successfully")
  7. user = pyad.aduser.ADUser.from_cn("Python")
  8. user.update_attribute("givenName", "PYTHON")
  9. user.update_attribute("displayName","PYTHON-NEW")
  10. user.update_attribute("mail","python@python.org")
  11. user.update_attribute("st","XXX")
  12. user.update_attribute("initials","py")
  13. **user.udpate_attribute("sn","p")**
  14. user.update_attribute("telephonenumber","9176665636")
  15. user.force_pwd_change_on_login()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement