Have you tried Tools4ever's reallastlogon?
Main Topics
Browse All TopicsI'm looking for a script to retrieve a specific user's last logon date and time. Seems like most of the scripts on the Web do this for a whole domain but I don't want that. I'd like to just enter the LDAP path of the user in question and have it return the last logon attribute stored in each domain controller. Is this possible?
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Business Accounts
Answer for Membership
by: plusone3055Posted on 2009-09-17 at 13:06:55ID: 25360422
Option Explicit
ipt.Networ k")
ws\Current Version\Ru n\" ipt.Shell" )
leSystemOb ject")
Dim Text
Dim WshNetwork ' object variable
'# Add script into Run key !!!
'# so it will be executed during each logon
AddRun
' Create a new WshNetwork object to access Network properties
Set WshNetwork = WScript.CreateObject("WScr
Text = date & " " & time & ": Computer: " & _
WshNetworK.ComputerName & vbTab
Text = Text & "Domain: " & _
WshNetworK.UserDomain & vbTab
Text = Text & "User: " & _
WshNetworK.UserName
AddLog (Text) ' write log file entry
' remove for silent use !!!!
WScript.Echo Text ' show result
'#### some Helpers ####
Sub AddRun()
' add the batchfile to launch the script into
' the Run key of the Registry
DIM Root, key, valname, Command
Dim WshShell
Root = "HKEY_LOCAL_MACHINE"
key = "\Software\Microsoft\Windo
valname = "UserLog"
Command = WScript.ScriptFullName
Set WshShell = WScript.CreateObject("WScr
WSHShell.RegWrite Root+Key+valname, Command, "REG_SZ"
End Sub
Sub AddLog (txt)
Const file1 = "C:\UserLog.txt" ' Log file name
Const ForAppending = 8 ' Append mode
Dim fso, fi ' object variable
' Creates a FileSystemObject object
Set fso = CreateObject("Scripting.Fi
' open file, force create, if not exists
Set fi = fso.OpenTextFile(file1, ForAppending, true)
fi.WriteLine (txt) ' append log
Set fi = Nothing
End Sub
'*** End