Split the difference, grab adfind from www.joeware.net in the free windows tools section and see what it decodes the values to. I can't speak to acctinfo dll as I never used it. _vbscript_ decoding of int8 values is often troublesome, it is possible the code below isn't doing a very accurate decode, I haven't checked it. I can guarantee adfind is doing it well with the possible debate around DST issues and what really should be displayed (should it be a value that was accurate at the time or a value accurate after a DST switch).
 
The most accurately returned values I have seen for _vbscript_ have been out of code Richard Mueller has put together.
 
  joe


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Smith, Robin
Sent: Friday, May 27, 2005 2:31 PM
To: 'ActiveDir@mail.activedir.org'
Subject: [ActiveDir] lastlogontimestamp

Hi. Our domain is at the Windows 2003 server functional level. I have registered acctinfo.dll from the 2003 resource kit and have the Additional Account Info tab in ADUC. I am finding a big discrepancy between the lastlogontimestamp date on the Additional Account Info tab and the actual lastlogontimestamp date. For example, John Doe shoes a lastlogontimestamp of 11/23/04 in ADUC. However, if I execute the following script:

 

Set objUser = GetObject("LDAP://cn=John Doe, ou=MOET (g14), ou=Field Users, ou=LWD Accounts, dc=njdol, dc=ad, dc=dol")

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#

 

(code was taken from here: http://www.microsoft.com/technet/scriptcenter/topics/win2003/lastlogon.mspx)

 

I get a much more current date (5-25-05). This is happening with more than one user. Any explanation for why this happens. I've done a lot of reading this week and I understand that the lastlogontimestamp field could be off by 7-10 days but this is several months.

 

Thanks,

Robin

NJDOL

 

Reply via email to