pyad create user 1

pyad create user

from pyad import *

pyad.set_defaults(ldap_server="IT-LHQ-DC1.LIFEALIKE.LAB", username="administrator", password="password")

ou = pyad.adcontainer.ADContainer.from_dn("ou=All_Users, dc=LIFEALIKE, dc=LAB")
new_user = pyad.aduser.ADUser.create("test.02", ou, password="password")

Here is what the above code is Doing:
1. Set the default LDAP server and credentials to use for all subsequent operations.
2. Get the ADContainer object for the OU “All_Users”
3. Create a new user in the OU “All_Users”

Similar Posts