Re: lastLogonTimestamp

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Joe Richards [MVP] wrote:
lastLogonTimeStamp is only available in Domain Functional Mode 2
(Windows Server 2003 Mode), most likely you are in Windows 2000 Mode.

--
Joe Richards Microsoft MVP Windows Server Directory Services
Author of O'Reilly Active Directory Third Edition
www.joeware.net


---O'Reilly Active Directory Third Edition now available---

http://www.joeware.net/win/ad3e.htm



Chris wrote:
I've been trying to find out the last time users had logged onto our
domain. I discovered a script here at the TechNet Script Center. I
adapted to what I wanted to query but I ran into an error: "The
directory property cannot be found in the cache." This occured at the
statement executing: Set objLastLogon = objUser.Get("lastLogonTimestamp")

I'm afraid I know very little about AD or LDAP so I can't imagine what
would be the problem. The server is running Windows Server 2003. The
code I used is as follows:

Set objUser = GetObject("LDAP://CN=Ed
Fred,CN=Users,DC=CDPSCITRIX,DC=SAFETY,DC=STATE,DC=CO,DC=US")
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#

Could someone assist me on this?

Thanks!

Or perhaps you have a typo in your actual script you're running. Make
sure the attribute you're trying to pull is spelled properly. I was also
going to say something along the lines of what Joe did, however perhaps
something is messed up in your schema. While that's rather unlikely, it
is always possible that someone decided to delete that attribute out of
the schema :)

Trevor Sullivan
Microsoft Certified Professional
.



Relevant Pages

  • Re: Where to obtain latest version of DS CLI tools
    ... Joe Richards Microsoft MVP Windows Server Directory Services ... > out when trying to query or add users on 2000 active directory.. ...
    (microsoft.public.windows.server.active_directory)
  • Re: PasswordFilter and ASP.NET
    ... > Joe Richards Microsoft MVP Windows Server Directory Services ... >> history though, I think it only checks complexity, etc. ... >>> A lot of the password policy you can actually read by querying the DC. ...
    (microsoft.public.platformsdk.security)
  • Re: Monitoring AD
    ... Joe Richards Microsoft MVP Windows Server Directory Services ...
    (microsoft.public.win2000.active_directory)
  • Re: Change the mode of the domain on Windows server 2003 sp1
    ... Joe Richards Microsoft MVP Windows Server Directory Services ... (The script is founded on the book "Active Directory ...
    (microsoft.public.windows.server.active_directory)
  • Re: Books on Windows 2003 Server Active Directory
    ... Directory which was massively updated by Joe Richards. ... Paul Williams ... Microsoft MVP - Windows Server - Directory Services ...
    (microsoft.public.windows.server.active_directory)