Last Logon date to XP or NT

I have been tasked with creating a report that shows which machines have not been used in the last month. I suspect the only way to do that is to find some way of showing when a machine was last logged on to.

I am using landesk to collect the information. I can look at when a file was last executed or find a registry key.

I have tried using userinit.exe but the results were not reliable. Does anyone know of a way to show this?

Cheers.

Peter
PLSMAsked:
Who is Participating?
 
pjedmondCommented:
The 'Event Viewer' security log should show when a user logged on/off, and the application log will show which user executed an application and when. You'll need to read the files rather than just look at the timestamp I'm afraid.

If the logon is authenticated as part of an domain, then the server logs may be of use?

(   (()
(`-' _\
 ''  ''
0
 
PLSMAuthor Commented:
Ah... Unfortunately we do not have Auditing enabled on any of our client computers, and this has got to work retrospectively.

I will have a look at AD, but I seem to remember that AD can only give you last login for the users, not when a computer was last logged in to. However, I could well be wrong!

Thanks.
0
 
cyberhicCommented:
Excellent.....This should not be to bad.  The first thing that comes to mind is to just take a look at the "C:\documents and settings" folder using the "Details" view.  Check the modified dates and this will show you the last time the computer was logged into, and by whom.

If your workstation base is larger like mine.  Just write a script to do it.  You could get export a list or workstations out of AD or even Server Manager (NT) and then just loop your script to collect file modify dates from each machine.  Easy pleasy.

If your not a scripter, check out:
http://www.microsoft.com/technet/scriptcenter/default.mspx

Its a great resource...
0
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

 
MikeKaneCommented:
In an XP machine, look in the "Documents and settings folder". You can check the date stamp on the hidden file NTUSER.DAT.   The date should give you a good idea when the mahcine was last used by that person.  

You'll need to look in every profile directory for each instance of NTUSER.DAT, and return the most recent date on the ntuser file from any of the profile directories.  

0
 
PberSolutions ArchitectCommented:
Try this script:

MAXIMUM_PASSWORD_AGE = 30

dtmDate = DateAdd("d", -MAXIMUM_PASSWORD_AGE, Now())
dbl100NanoSecs = 10000000 * (DateDiff("s", "1/1/1601", dtmDate))
dbl100NanoSecs = FormatNumber(dbl100NanoSecs, 0, False, False ,0)

set oRootDSE = GetObject("LDAP://RootDSE")
strDomainNC = oRootDSE.Get("defaultNamingContext")
set oRootDSE = Nothing


Set oConnection   = CreateObject("ADODB.Connection")
oConnection.Provider   = "ADsDSOObject"
oConnection.Open "Active Directory Provider"

Set oCommand = CreateObject("ADODB.Command")
Set oCommand.ActiveConnection = oConnection

strQuery = "<LDAP://" & strDomainNC & ">;(&(objectCategory=Computer)(lastLogonTimestamp<=" & dbl100NanoSecs & "));ADSPath;subtree"  
WScript.Echo strQuery
oCommand.CommandText = strQuery  
oCommand.Properties("Page Size") = 1000
Set oRecordSet = oCommand.Execute

if not oRecordSet.Eof Then

      WScript.Echo "Total: " & oRecordSet.RecordCount
      While Not oRecordSet.Eof
            Set ObjComp = GetObject(oRecordSet.Fields("AdsPath").Value)
            set objLogon = ObjComp.Get("lastLogonTimestamp")
            intLogonTime = objLogon.HighPart * (2^32) + objLogon.LowPart
            intLogonTime = intLogonTime / (60 * 10000000)
            intLogonTime = intLogonTime / 1440
            intLogonTime = intLogonTime + #1/1/1601#
            
            WScript.Echo Replace(Objcomp.name,"CN=","") & ", " & intLogonTime
      '      End if
            oRecordSet.MoveNext
      Wend
      
end If
WScript.Echo("done...")
0
 
PberSolutions ArchitectCommented:
Hmmmm, now that I read your post, this will probably not do the trick.  This will show the last time the computer was last on the domain, but for it to work in your case, the machine would have had to been powered off or disconnected from the network.
0
 
engineer_dellCommented:
Probably what you want is a software like this, LANsurveyor > http://www.neon.com/lsa3.shtml
                            OR
http://www.rlmueller.net/Last%20Logon.htm
This program can be modified to retrieve the lastLogon date for all
computers instead of all users by changing this statement:

strFilter = "(& (objectCategory=person)(objectClass=user
))"
to this:
strFilter = "(objectCategory=computer)"

I hope this helps.

Engineer_Dell
0
 
PLSMAuthor Commented:
Thanks for all the comments. I will try it all and come back to the group.
0
 
FriarTukCommented:
http://www.microsoft.com/technet/scriptcenter/default.mspx

http://support.microsoft.com/default.aspx?scid=kb;en-us;300549
Administrative Tools
- Domain Security Polices > Local Polices > Audit Policies
- Define Audit Account Logon Events
- Define Audit Logon Events
event viewer, rclk System Log > Properties > Filter (by computer, user, etc)

also see this from robwill
http://www.experts-exchange.com/Networking/Microsoft_Network/Q_21902477.html#17004392
0
 
FriarTukCommented:
plsm, plx respond to the advice in my last comment on 7/2
0
 
PLSMAuthor Commented:
The resolution has been found. Thanks for all your comments. Unfortunately LANDesk has to be used for this task for political reasons.

In case your are interested, in brief, we have solved this by writing a login/logoff date, time, and user name to the client machines, using some VBS in a login script. Using the login script we do some time calculation to find the difference between login and logout. That value is then written to another key, named by month. Every time someone logs on and off the time value found is added to the value already in the month key. When a new month starts a new month key is created. That key can then be found by LANDesk and reports can be made.

Thanks again for you comments.
0
 
FriarTukCommented:
so you didn't find the script from Robwill from the below link (orginally listed in above thread) helpful to build your script?
http://www.experts-exchange.com/Networking/Microsoft_Network/Q_21902477.html#17004392
0
 
rindiCommented:
PLSM, can you please follow my advice above? It helps a lot if you close your own question, thanks.

rindi,
EE Cleanup Volunteer
0
 
rindiCommented:
PLSM, are you still there? Have you read my last post?
0
 
FriarTukCommented:
i think my comment from 7/2 should be accepted since he stated on 7/24 he made a login/logoff script which my link pointing to Robwill's advice more than likely helped them make theirs or at least mentions doing so which led to the answer.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.