The following VBS script will change the last user logged on, information which is stored in the registry simply copy it into a text document and save it with the vbs file extension.
This script has been used with Windows XP on an Active Directory domain to change which user was last logged on.
on error resume next
dim WSHShell
Set WSHShell = Wscript.CreateObject("WScript.Shell")
dim strRegKey
strRegKey = "HKLMSOFTWAREMicrosoftWindows NTCurrentVersionWINLOGON"
StrUser = InputBox("Please enter in username," & vbCrLf & vbCrLf & "e.g. joe.local", "Set Last logged on", "username")
StrDomain = InputBox("Please enter in domain for logon," & vbCrLf & vbCrLf & "e.g. DOMAIN", "Set Logon Domain", "DOMAIN")
wshShell.RegWrite strRegKey & "DefaultDomainName", StrDomain, "REG_SZ"
wshShell.RegWrite strRegKey & "DefaultUserName", StrUser, "REG_SZ"
wshShell.RegWrite strRegKey & "AltDefaultDomainName", StrDomain, "REG_SZ"
wshShell.RegWrite strRegKey & "AltDefaultUserName", StrUser, "REG_SZ"
wshShell.RegWrite strRegKey & "AutoAdminLogon", "0", "REG_SZ"
WScript.Echo "Setup Completed. Please restart the computer to complete the process"
I just wanted to say thank you to whoever took the time to post this script. It is AWESOME and will save so much time! When we log on as an admin to do some work on a machine, if we don’t then log back on as the user and then off again, they don’t know to change the domain back, and they get really confused. Thank you!!!!