- Windows Vista
- Windows Server 2008, R2
- Windows 7
Take the hypothetical situation: Windows 7 fails to boot, you don’t want to lose your user data so you install 7 onto a clean partition. However your old user profile is associated with the random SAM ID from the old installation and the new Windows installation cannot mount the profile. You can copy your data files back over, but you really don’t want to configure the start menu settings for the 1,000,000th time.
Or how about: Your only domain controller failed leaving disassociated roaming profiles on a roaming profile share and you want to recover as much of the user settings and data as possible for use on the newly build AD forest. <– That actually happened to Matt, hence I day dreamed this up.
NT user accounts are associated to a Security Account Manager (SAM) ID. The SAM ID is Windows’s SAM or the Active Directory domain user services way of identifying a user, in effect the SAM ID is a super key that identifies a user account on a windows system, acting as a GUID for that profile.
The user name itself is irrelevant and plays no part in identifying the user account apart from being used to performing a reverse lookup to get to the SAM ID, on which Windows bases its logon activities and security token generation in AD.
When you reinstall Windows, the new installation has no awareness of any of the accounts, so if you copy the profiles back into the Windows users directory you will be unable to re-associate that profile with the local SAM database.
The simplest way of restoring user data and crucially environment settings (such as desktop wallpaper, window settings and the like) is to follow this process:
- Create a new user account for the user you want to migrate onto the new domain/installation
- Set the accounts roaming profile settings (if dealing with a roaming profile)
- Logon to the machine with Administrator rights
- Load Regedit
- Click on HKEY_USERS
- From the File menu, select Load Hive…
- Browse to the NTUser.dat from the previous install/roaming profile for the profile that you are trying to recover and click OK e.g.
- When prompted for a name just enter temp and click OK
- Expand and click on:
- From File select export and save the export file as:
- From File, select Unload Hive…
- Exit Regedit
- Open c:\temp.reg
- From the Edit menu select Replace…
- In Find What: enter:
In Replace With: enter:
Press Replace All
- Save the reg file and exit notepad
- Log off of Administrator
- Log on as the new user
- Double click on c:\temp.reg and import the reg file into the new (completely default) user account. If you are using a system with UAC you will need to import the reg file using an administrators account.
- Immediately log off
- Log back in as Administrator
- Go to the recovered profile folder e.g.
- Select all files in the folder apart from NTUser.dat, NTUser.ini and NTUser.dat.log and copy them
- Paste the data into the new user profile e.g.
- The data and the profile settings have now been recovered. Logging back in as the recovered user will restore much of the user profile and all of their data.
Note: It may be necessary to reset folder permissions and ownership on all of the files pasted into the folder to match that of the new user account.
Thanks to Matt Gillard of MGComputing for some testing of my theory.