Advertisement
Guest User

Untitled

a guest
Mar 18th, 2017
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. ADUser:
  2. firstName: <value>
  3. lastName: <value>
  4. username: <value>
  5. email: <value>
  6. group: <value of group I want them to join>
  7.  
  8. with open("AD.yaml", 'r') as stream:
  9. try:
  10. print(yaml.load(stream))
  11. except yaml.YAMLError as exc:
  12. print(exc)
  13.  
  14. q = pyad.adquery.ADQuery()
  15. q.execute_query(
  16. attributes = (["firstName", <value>],["lastName", <value>],["username", <value>],["email", <value>])
  17. where_clause = "objectClass = '*'",
  18. base_dn = "OU=users, DC=domain, DC=com"
  19. )
  20.  
  21. #User Creation
  22. create_user(name, password=None, upn_suffix=None, enable=True, optional_attributes={})
  23. #Find Members of a group
  24. get_memberOfs(recursive=False, scope='all')¶
  25. #Add an object to a group
  26. add_to_group(group)
  27. #Query AD
  28. q = pyad.adquery.ADQuery()
  29. q.execute_query(
  30. attributes = ["distinguishedName", "description"],
  31. where_clause = "objectClass = '*'",
  32. base_dn = "OU=users, DC=domain, DC=com"
  33. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement