There are few cases where you’d like to rename somebody’s user account as well as profile folder and I will explain on how to do it properly.
First of all, let’s start with..
- The account is local
- You have to temporarily disconnect it from Microsoft account
- This is not easily possible for Azure/AD accounts
- The target account name does not exist and it never existed
- You have access to another admin account on the same machine
If you are ready with above..
For this scenario let’s rename imaginary account ‘badname’ to ‘goodname’, with help of another admin account ‘administrator’.
- Log in as administrator
- Go to Control Panel > User Accounts > Manage another account > Choose badname > Change Name
- Now rename the account to goodname
- Rename folder C:\Users\badname to C:\Users\goodname
- Do batch search and replace in the registry, I found it was the easiest using tool like Advanced Regedit (win32)
- Upon opening the program press Ctrl + H
- Follow example below and define Start and End keys:
- Create a symbolic link to ensure compatibility with some hardcoded entries by some programs using following command (run cmd.exe as admin):
mklink /d C:\Users\badname C:\Users\goodname
- Now reboot the system and log in with the new username.
- You can re-connect to Microsoft account now :)