Skip to content

Instantly share code, notes, and snippets.

@dbirks
Last active June 3, 2024 02:07
Show Gist options
  • Save dbirks/ec4416c9064a323b14f435ee934efd71 to your computer and use it in GitHub Desktop.
Save dbirks/ec4416c9064a323b14f435ee934efd71 to your computer and use it in GitHub Desktop.
Change last logged on user on Windows 10

In Windows 10 you can no longer change the last logged on user in the registry like you could in Windows 7. Windows 10 requires the user's SID to be entered as well. Here's an updated guide.

In HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI, you'll want to change 4 entries:

  • LastLoggedOnDisplayName
    • Enter the user's full name, like Allan Jude
  • LastLoggedOnSAMUser
    • Enter the username, like SHORTDOMAIN\allan.jude
  • LastLoggedOnUser
    • Enter the username again, like SHORTDOMAIN\allan.jude
  • LastLoggedOnUserSID
    • Enter the user's SID, like S-1-5-21-112783954-3472839473-6329827380-1437
    • You can find the exact SID with wmic useraccount where name='allan.jude' get sid
    • Or you can search through the list of all users with wmic useraccount, and pipe it into Windows's version of grep, which I find easier to remember: wmic useraccount | findstr allan

Now you can log out, and you should be good to leave the workstation for the user.

@Bixilon
Copy link

Bixilon commented Mar 7, 2022

Hm, seems to work for logging off. Any approaches for restarting the system?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment