locked
Clear last logon user name RRS feed

  • Question

  • I have seen various threads that you can clear the last logon username by registry or policy but I only want to do it once - i.e. logon as local administrator, do some work and then reset the logon screen so it is blank fresh for user. In XP it was simply a question of clearing a couple of registry keys - any way to do the same in Win 7 ?

    Thanks


    Ian Burnell, London (UK)
    Friday, October 8, 2010 6:13 PM

Answers

  • Hi guys,

    yes I also understood this correctly at the first place. Damn standard answers. Was just searching for the same solution and the internet is full of removing the last logged on user forever which is one of the most annoying features.

    What I've done now is to search for my own logon name in the registry and found following key which gave me the desired result right away after I've deleted it.

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\LastLoggedOnUser

    This is at least now working on Windows 7 SP1.

    This gives me ONE TIME a blank logon screen which asks for username and password.

    Maybe my comment on this was still helpful. At least for other guys searching the web for this.

    Cheers

    Robert


    As small add-on to this:

    Recgnized that this works well when logging off and logging on but the rebooting the computer the local admin account is shown on the logon. To really get the username and password field after the reboot do not delete the value rather remove it's data (empty string).

     

    • Marked as answer by Ian Burnell Monday, June 13, 2011 3:14 PM
    Thursday, June 2, 2011 11:14 AM

All replies

  • Hi Ian

    It isn't clear what exactly you are trying to do?

    If you enable the policy to clear the last logon user name, this changes the logon screen to one that does not display any user names. Each user must type their user name and password to log on.

    If you disable this policy, then the standard logon screen is displayed with all user names visible. The user is still required to type their password.

    It would be very easy to quickly switch this screen using the registry.

    Create 2 registry files.

    1. DontDisplayLastUserName_Enabled.reg with the following text.

    Windows Registry Editor Version 5.00

    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System]
    "dontdisplaylastusername"=dword:00000001

    2. DontDisplayLastUserName_Disabled.reg with the following text.

    Windows Registry Editor Version 5.00

    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System]
    "dontdisplaylastusername"=dword:00000000

    To switch the logon screen simply Merge the appropriate file.

    Hope this helps.

    Thank You for using Windows 7


    Ronnie Vernon MVP
    • Proposed as answer by Ronnie VernonMVP Sunday, October 10, 2010 10:03 AM
    • Marked as answer by Linda Yan Monday, October 11, 2010 9:32 AM
    • Unmarked as answer by Ian Burnell Monday, October 11, 2010 1:20 PM
    Sunday, October 10, 2010 10:01 AM
  • There is also an alternative route to doing this(even though you specified reg keys):

     

    Run gpedit.msc


    Expand Computer Config

    Windows Settings

    Security Settings

    Local Policies

    Security Options

     

    Look for the following "Interactive Logon:Do not display last user name"

     

    Hope this helps you out.


    MCP, MCSE, MCDST, MCSA, MCT, MCITP:EA, MCITP:CST, A+, N+, CTT+, MCTS, CBP
    • Proposed as answer by Tim Katsapas Monday, October 11, 2010 8:16 AM
    Monday, October 11, 2010 8:16 AM
  • I probably didn;'t make myself clear. I only want to do this ONCE. I have to logon as local administrator after build to do some comfort checks. So all I want to do is clear THAT entry. Then the new owner of the machine logs on as normal and his/her name IS held as normal so they don't have to keep retying their username. I appreciate your reg script Ronnie - but I not sure how you could set it back without running that reg fix remotely
    Ian Burnell, London (UK)
    Monday, October 11, 2010 1:22 PM
  • No You madwe yourself very clear, the MVP's just did not bother to actually read it.

    You should be able to simply clear this key:

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon
    And be good.
    What I did was clear it on my own machine and export it to a USB key (same one I use for AV scans etc) the I can just double click it before I leave someone's desk and restart the PC.
    Saves my account from constantly getting locked out.
    Good Luck,
    Jeremy
    Tuesday, November 30, 2010 3:22 PM
  • Hi guys,

    yes I also understood this correctly at the first place. Damn standard answers. Was just searching for the same solution and the internet is full of removing the last logged on user forever which is one of the most annoying features.

    What I've done now is to search for my own logon name in the registry and found following key which gave me the desired result right away after I've deleted it.

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\LastLoggedOnUser

    This is at least now working on Windows 7 SP1.

    This gives me ONE TIME a blank logon screen which asks for username and password.

    Maybe my comment on this was still helpful. At least for other guys searching the web for this.

    Cheers

    Robert


    As small add-on to this:

    Recgnized that this works well when logging off and logging on but the rebooting the computer the local admin account is shown on the logon. To really get the username and password field after the reboot do not delete the value rather remove it's data (empty string).

     

    • Marked as answer by Ian Burnell Monday, June 13, 2011 3:14 PM
    Thursday, June 2, 2011 11:14 AM
  • Thanks Robert - revisiting my old threads but looks like a good solution
    Ian Burnell, London (UK)
    Monday, June 13, 2011 3:15 PM
  • This works well for me in Windows 7 SP1.

    reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI /v LastLoggedOnUser /d "" /f

     

    Thursday, December 22, 2011 3:55 AM
  • Your post is perfect. This is exactly what I was looking for. I'll often login with my domain admin account to setup a PC and then have my account locked out by the user not changing the username.
    Wednesday, January 15, 2014 1:06 AM
  • Sadly doesn't work in 8.1 

    Is there any way to do that in modern OS's?


    Wednesday, March 9, 2016 11:12 AM
  • On Win10, deleting the LastLoggedOnSAMUser from HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI did the trick for me. 

    To clarify it's the LastLoggedOnSAMUser entry and not the LastLoggedOnUser entry as it was for Win7 - deleting LastLoggedOnUser on Win10 didn't produce the expected result of clearing the last logged in user at the next login as you noticed on Win 8.1.


    • Edited by Aakash Shah Friday, September 15, 2017 11:07 PM
    Friday, September 15, 2017 11:06 PM
  • I know this is really old but #1 All you need to do is Reverse it.  #2 Educated Meatheads is what they are.

    Helpful nice guy

    Friday, May 4, 2018 12:10 PM
  • Thank you, this worked with out any issues.
    Thursday, February 28, 2019 5:05 AM