I'm trying to get some data from the Active Directory in SQL. I use the code:
SELECT * FROM OpenQuery
(
ADSI,
'SELECT objectGUID, objectSID, employeeID, lastLogon, mobile, telephoneNumber, mail, department, givenName, sn, displayname, sAmAccountName
FROM ''LDAP://DC=mycompany''
where objectClass = ''user''
and sAmAccountName = ''testuser'''
)
My problem is that the value i receive for lastLogon isn't refreshing. It is possible that the other values aren't also refreshing, however i can't say this for sure, because in the other data there is no change, but the lastLogon value should be updated when i lock my computer and log in.
Does anyone have any idee why is this, and how can i solve this?
Thanks!