Windows operating system, including Windows Vista, Windows 7 and Windows Server, is designed in a way that the last user who logged into the system is remembered, and is displayed automatically on next log in, so that user has to just enter the password to log on. In the Welcome Screen, user account names are listed, or in the case of only single account available, automatically selected to prompt for password. In classic Windows logon box (including the Logon to Windows box after press Ctrl + Alt + Delete shortcut), the user name who logged in most recently is displayed as user name to log on.

The behavior to remember and display the last user name who logged in to the Windows system most recently is built into Windows operating system to allow user to login quickly by just entering password. However, some users may not like the feature as it will give away the identity of user who used the computer. In addition, on common shared PC, there will be additional steps to delete, remove and clear the user name before entering the correct own user ID. User who forgotten to change the user ID on display can accidentally lock other user out if trying too many incorrect password.

Windows provides a registry or group policy trick that instruct Windows not to remember and display the last user name who logged in. Follow the steps below to tweak the registry setting or group policy:

  1. Run Registry Editor (RegEdit).
  2. Navigate to the following registry key:


  3. In the right pane, double click on DontDisplayLastName registry key value, and set its value data to 1.

    Don't Display Last User name

Alternatively, the registry key above can be changed and modified via Local Security Policy Editor, as shown in guide below.

  1. Click on Start button, and type secpol.msc into Start Search box, and hit Enter to open the Local Security Policy Editor.
  2. Navigate to Security Settings -> Local Policies -> Security Options.
  3. In the right pane, double click on Interactive Logon: Do not display last user name.
  4. Select and set the radio button of Enabled.

    Enable Do Not Display Name of Last Logged In User Policy

  5. Click Apply or OK.

Once enabled, the name of the last user to successfully log on is not displayed in the Logon Screen.

Related Posts

  • pn

    I followed these instructions. I used “DontDisplayLastName” and it didn’t work. Change “DontDisplayLastName” to “DontDisplayLastUserName”.

    Thanks for the article.

  • Monica Renicks

    Very clear instructions, thanks.

    We implemented this change but it also seems to clear the Outlook username for users. Is this the expected action as I assumed it was only going to blank the AD login. Thanks.

  • Naresh


    Thanks a lot for this detailed and well articulated post.

    This really helped me get rid of a ton of headache…

    Rock On !!!


    • Eric

      Is there a way to do this only temporarily? In other words, just have it forget the current logged-in username when you log off, but then still remember for all subsequent logins?

      • cosmicsync

        That is an excellent question, and one I've been trying to find an answer to for quite a while. In XP, you could simply clear the AltDefaultUserName and DefaultUserName values in the registry and the username field would be blank on the next login.

        This technique was great for preventing users from locking out your account by repeatedly inputting their password with your username, but would only do that on the next login, returning the machine to "normal" after that.

        Unfortunately, this feature was apparently far too useful to be included in MicroSoft's latest offering; I can not find those values or similar ones in the Windows 7 registry, and any solutions I've been able to find are like this one – all or nothing. While it might be better from a security standpoint to simply tell users from now on you have to input both username and password, it would be nice to have the flexibility to be able to prevent it from happening on the next login only.

        If anyone has come up with a technique to stop Windows 7 from defaulting to the last logged in username for the next login only, I'd love to hear about it.

        • kaoo

          Can I get the script for
          displaying of “Last date logon”

      • cosmicsync

        Hi Eric

        Well, better late than never …

        For you and anyone else who might find this thread looking for a way to stop Windows 7 from displaying your username when you log out or restart the machine, but then revert back to the default behaviour of displaying them for subsequent sessions, follow these steps:

        1. Click Start
        2. Type regedit in the search box to find the Registry Editor and run it (must be run with Administrator privileges).
        3. Press Ctrl-f to open the Find dialog and search for the string LastLoggedOn
        3. It may take a few seconds, but it will take yo to the LoginUI section of the registry. Double-click on the LastLoggedOnSAMUser key and clear your username from the Value data section (or, if you’re feeling especially generous, replace it with the username of the person who normally uses the machine). Click OK.
        4. Repeat step 3 with the LastLoggedOnUser key.
        5. Close the Registry Editor and log out or shut down the machine.

        The next time the machine is started, the user will be prompted for both a username and password, but after that the username will be remembered for subsequent sessions.

        ** Be careful when editing the Registry, as you can do a great deal of damage just by changing the value of the wrong key. I’ve used the above on numerous machines without incident, but this advise comes with no warranty.

        • Patrick

          Thank you so much, I have spent the better part of the last 2 days looking for this, and as you said everything I found was an “all or nothing solution”. I needed to wipe my log on when I was fixing users workstations, because they kept locking me out, and I would really prefer not to train them to remember their username AND password (I know it sounds trivial, but it’s true). The key was just what I was looking for.