Download: go.cwl.cc/lastlogin – Source Code: here
The administration is always a hot topic here. Heck, that’s what we do here. We’re always looking to do more with administration tools available. One simple scenario that network administrators see often is logging into a Windows PC as an administrative user, and then logging out, leaving the default user as administrator. If you have changed the administrative username, you probably don’t want to let anyone see it. In other cases, you might just want to make it easier for the user of the current machine to get back into the computer.
So, the problem was “How to return the previous user’s name to what it was before?”. I took a look at this problem in a previous blog post, and part of that was to create a small program that makes returning the username quick and easy.
LastLogin is a small Windows Console application written in Free Pascal. The application takes no command line parameters and should be run with administrative privileges.
The process goes like this:
1. You run the application (with administrative privileges)
2. The previous user is displayed (essentially who you’re logged in as now)
3. A prompt will ask if you’d like to change the user, answer “y” or “n” and press enter
4. A prompt will ask for the user name
5. A prompt will confirm the username and ask if you’d like to write to the registry, “y” to accept, “n” to reject.
6. The application finishes and pauses (for input to exit)
Sample output of LastLogin is as follows: