problems accessing object [<COMObject GetEx>] using python pyad

1.3k Views Asked by At

I'm having problems trying to access the active directory user attribute using pyad. Here is my code:

user = pyad.aduser.ADUser.from_cn("tuser")
print user.get_attribute(lastLogonTimestamp")

These are the printed attributes:

C:\Users\tuser\Desktop\docb0t>python docb0t.py
[<COMObject GetEx>]

I have no idea how to retrieve the value off that object. How can I do it?

1

There are 1 best solutions below

3
On BEST ANSWER

I ran into this same issue and after a little digging figured out the answer. You need to run the attribute through the pyadutils.convert_datetime function.

print pyadutils.convert_datetime(user.get_attribute('lastLogonTimeStamp', False))

Enjoy!

TriSkulL