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
- Enter the user's full name, like
LastLoggedOnSAMUser
- Enter the username, like
SHORTDOMAIN\allan.jude
- Enter the username, like
LastLoggedOnUser
- Enter the username again, like
SHORTDOMAIN\allan.jude
- Enter the username again, like
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
- Enter the user's SID, like
Now you can log out, and you should be good to leave the workstation for the user.
You could use the following in a Powershell script if needed:
write-host "[INFO] Changing the last logged on user: " $USER = 'DOMAIN\USER' #change this variable with the target information $USERDISPLAY = 'Full User Name' #change this variable with the target information $USERSID = (New-Object System.Security.Principal.NTAccount($USER)).Translate([System.Security.Principal.SecurityIdentifier]).value write-host "[INFO] Changing LastLoggedOnDisplayName registry key -> " -NoNewline reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI" /v LastLoggedOnDisplayName /t REG_SZ /d $USERDISPLAY /f write-host "[INFO] Changing LastLoggedOnSAMUser registry key -> " -NoNewline reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI" /v LastLoggedOnSAMUser /t REG_SZ /d $USER /f write-host "[INFO] Changing LastLoggedOnUser registry key -> " -NoNewline reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI" /v LastLoggedOnUser /t REG_SZ /d $USER /f write-host "[INFO] Changing LastLoggedOnUserSID registry key -> " -NoNewline reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI" /v LastLoggedOnUserSID /t REG_SZ /d $USERSID /f
This could be ran at each user log-out if you need to default to a single user on a given machine.