Rename Your Windows User Profile Directory
Renaming the default Windows user profile folder (e.g., C:\Users\John → C:\Users\JohnDoe) requires care. This guide provides step-by-step instructions and a PowerShell script that automates the registry update and folder rename safely.
🧭 Overview
Windows ties each user account to a unique SID and folder path under C:\Users. Simply renaming that folder breaks logins and causes OneDrive and app failures.
This guide explains how to:
- Detect whether you’re logged into the profile being changed
- Create a temporary local admin helper account if needed
- Rename the profile folder safely
- Update the registry and fix permissions automatically
⚙️ Download the Script
You can get the PowerShell script directly here:
➡️ Download Rename-UserProfile.ps1
(Right-click → “Save link as…” if your browser shows the code instead of downloading it.)
🪟 How to Use
1. Run as Administrator
Open Windows Terminal (Admin) or PowerShell (Admin), then run:
powershell -ExecutionPolicy Bypass -File "$HOME\Downloads\Rename-UserProfile.ps1"
2. Enter Names
When prompted:
- Current name: the existing folder under
C:\Users - New name: your desired folder name
3. If You’re in the Profile to Be Renamed
If the script detects you’re logged into that profile, it will offer to:
- Create a helper admin (e.g.,
Admin-Rename-Helper) - Copy the script to
C:\Users\Public - Instruct you to log out and run it from that new admin account
4. Complete the Rename
Once run from another admin:
- The script updates the registry (
ProfileImagePath) - Renames the folder
- Repairs file ownership and ACL permissions
You’ll see messages confirming each step.
🔁 After the Rename
- Reboot the PC.
- Sign into your renamed account and verify the folder path:
echo $env:USERPROFILEShould show:
C:\Users\NewName - Re-link OneDrive (if used):
Open OneDrive → Settings → Account → Unlink this PC → Sign in again.
🧯 Rollback (If Needed)
If anything seems off:
- Log in to another admin account.
- Rename the folder back to its original name.
- In Registry Editor, restore the original path under:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\<UserSID>
ProfileImagePath = C:\Users\OldName
✅ Tips
- Always create a restore point before renaming.
- Ensure the target account is signed out.
- Do not rename profiles for system or service accounts.
- This method works for both local and Microsoft accounts.
Author: Preston Powell
Script Source: Rename-UserProfile.ps1 on GitHub