Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ADUser:
- firstName: <value>
- lastName: <value>
- username: <value>
- email: <value>
- group: <value of group I want them to join>
- with open("AD.yaml", 'r') as stream:
- try:
- print(yaml.load(stream))
- except yaml.YAMLError as exc:
- print(exc)
- q = pyad.adquery.ADQuery()
- q.execute_query(
- attributes = (["firstName", <value>],["lastName", <value>],["username", <value>],["email", <value>])
- where_clause = "objectClass = '*'",
- base_dn = "OU=users, DC=domain, DC=com"
- )
- #User Creation
- create_user(name, password=None, upn_suffix=None, enable=True, optional_attributes={})
- #Find Members of a group
- get_memberOfs(recursive=False, scope='all')¶
- #Add an object to a group
- add_to_group(group)
- #Query AD
- q = pyad.adquery.ADQuery()
- q.execute_query(
- attributes = ["distinguishedName", "description"],
- where_clause = "objectClass = '*'",
- base_dn = "OU=users, DC=domain, DC=com"
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement