Find Last Logon Date and Time for Local User Accounts in Windows

In response to a script request recently from one of our readers, here is a VBScript that I came up with, that displays last logon date/time details for each local user account in a computer.

[Download lastlogon.vbs]

This script uses WMI’s Win32_UserAccount class to get the list of local user account information, queries the LastLogin property for each local user account and displays it in a message box.

If you need to know the last logon information at every startup, place the script into your Startup folder. To open the Startup folder of your user profile, press WinKey + R to access the Run dialog, type "shell:startup" (without quotes) and press {ENTER}. Drag the VBScript file to the Startup folder.

About the author

Ramesh Srinivasan founded back in 2005. He is passionate about Microsoft technologies and has a vast experience in the ITeS industry — delivering support for Microsoft's consumer products. He has been a Microsoft MVP [2003 to 2012] who contributes to various Windows support forums.

3 thoughts on “Find Last Logon Date and Time for Local User Accounts in Windows

  1. This script is fantastic, however, it is not pulling all of my users. I have a list of about 30 local users, but about 9 are not being listed. Any ideas on how I can get the others to populate?

Comments are closed.