Skip to Content
0
Former Member
Jun 02, 2009 at 10:36 AM

Returning Active Directory LastLogonTimeStamp

67 Views

Hi,

I am new to Crystal Reports. Previously I was using a VBScript to extract data from Active Directory, I want to automate this with Crystal Reports, because of layout options.

Within my reports I need the value "LastLogonTimeStamp". This value is a 64-bits integer as indicated by documentation written by Microsoft:

http://www.microsoft.com/technet/scriptcenter/topics/win2003/lastlogon.mspx

If I retrieve the value with a OLE DB (ADO) Microsoft Active Directory Services Interface the fields remain empty. When I click browse data the box also remains empty. I already tried converting the field to aa string value after quering it with Crystal, but no results.

Does anyone know a solution to this problem? With VBScript this problem is solved like this:

Set objUser = GetObject("LDAP://cn=Ken Myer, ou=Finance, dc=fabrikam, dc=com")
Set objLastLogon = objUser.Get("lastLogonTimestamp")

intLastLogonTime = objLastLogon.HighPart * (2^32) + objLastLogon.LowPart 
intLastLogonTime = intLastLogonTime / (60 * 10000000)
intLastLogonTime = intLastLogonTime / 1440

Wscript.Echo "Last logon time: " & intLastLogonTime + #1/1/1601#

Thank in advance for your reply.

Kind regards,

Laurens