I'm using this code to create a user in active directory, using the pyad
module in Python 2.7:
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")
How can I create a user with the checkbox of "No Password Expire"?
In AD, it's set via the
userAccountControl
attribute, which is a bit flag: https://msdn.microsoft.com/en-us/library/aa772300.aspxThe pyad library actually gives a method to modify this. This is what the documentation says:
I am not a Python programmer, but if I understand this correctly, it would look something like this: