Re: How to find "LastLogonTime" for users

Tech-Archive recommends: Fix windows errors by optimizing your registry



Hi again,
I tried to use the code from
http://www.microsoft.com/technet/scriptcenter/topics/win2003/lastlogon.mspx
but when i execute, i get an error, "lastlogon.vbs(2, 1) Active
Directory: The directory property cannot be found in the cache"

<code>
Set objUser = GetObject("LDAP://CN=Mohammed Athif Khaleel, CN=Users,
DC=a, DC=b, 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#
</code>

Any ideas??
Athif

.