We help IT Professionals succeed at work.

find Last 5 Logon on windows

with below command i can found last Logon for user Test on my windows :

net user test /domain

now i need find for example last 5 Last logon for user test .

how can i figure it out ?
Watch Question

I am using this one which really helps me lot for lot of login info.. I would suggest customize to your environment and use the same to get the details. Script https://gallery.technet.microsoft.com/scriptcenter/Find-user-logon-duration-667b8c48
There are a few options:

1. You could troll the security logs on each of your DCs, then manually or using some tool parse the events and try to piece together what has happened. A login may be recorded on and DC, and if the machine had no connection at login, there will be nothing on any DC. It can be a PITA.

2. Beforehand, compile a pair of simple scripts and deploy it as a logon/logoff scripts via a GPO, to write login events to a hidden file share. This way, anyone granted access can see login and logoff events. The scripts I use is below:
echo Logon,%DATE%,%TIME%,%COMPUTERNAME% >> \\dc01\onofflogs$\%USERNAME%.txt

Open in new window

echo Logoff,%DATE%,%TIME%,%COMPUTERNAME% >> \\dc01\onofflogs$\%USERNAME%.txt

Open in new window

This creates a nice little text file for each user, detailing each logon and logoff event, with a time and date stamp, as well as the machine name.
E ATech Lead
Start Command Prompt.
Enter cd C:\Windows\system32 and press Enter.
Then write quser and press Enter.

However, the login/logout times can be found under the Security section of Windows Logs in Event Viewer. It's worth looking around on Event Viewer to find other information you require.


You may also get help from free last logon reporter solutions like; Lepide and Manageengine.

Hope this helps!
Mark BillExchange, AD, SQL, VMware, HPE, 3PAR, FUD, Anti MS Tekhnet, Pro EE, #1

free trial of solarwinds log and event manager, great for this stuff.
Shared details, If still expert looking for more details then he can object.