How might I find if a user is active using pyad? I know how to get their department, username, name etc. but I don't know the proper name for activity status. Here is my code for getting their department and name:
x = aduser.ADUser.from_cn(i)
dept = x.department
name = x.displayName
act = x.?
users = i, dept, name, act
"i" is a list of usernames.
from pyad import aduser
user = aduser.ADUser.from_cn("User Name")
user_atrri = user.get_user_account_control_settings()
print(user_atrri['ACCOUNTDISABLE'])
False - Means Account is Enabled True - Means Account is Disabled
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.