for row in q.get_results():
print(row["Manager"],row["mail"], row["distinguishedName"], row["whenCreated"] , row["lastLogon"],row["accountExpires"],row["userPrincipalName"])
For some of the elements such as LastLogonDate, its return a COMObject instead of a date.
<COMObject > <COMObject >
Hello,
I am trying to pull a list of AD Group users that have logged in recently, and when their account expires.
See code snippet below:
import pyad.adquery q = pyad.adquery.ADQuery()
q.execute_query( attributes = ["distinguishedName", "mail", "whenCreated", "Manager", "lastLogon","accountExpires","userPrincipalName"], where_clause = "objectClass = 'user'",
base_dn = "OU=users, DC=domain, DC=com"
)
for row in q.get_results(): print(row["Manager"],row["mail"], row["distinguishedName"], row["whenCreated"] , row["lastLogon"],row["accountExpires"],row["userPrincipalName"])
For some of the elements such as LastLogonDate, its return a COMObject instead of a date. <COMObject> <COMObject >
Any help is appreciated