Windows 7 starting with a temporary profile

Symptom
The user logs in only to find out that their profile could not be located and the system has logged them in under a " temporary profile".. When going to the users directory, they see their old profile along with a new profile file with the name "TEMP. (computer name).

When logged in with an admin account the profile status is set to backup.
Cause

Undetermined at this time.

  • Check the reigistry setting: HKLM\Software\Microsoft\Windows NT\ProfileList\<SID>\RefCount registry entry for the user in question. We have seen where this never gets decremeted and thus tells windows the user still has an active session even though the user does not. If this is not 0, Windows believes the user has an active session.
  • When a user logs on, their registry profile at
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\<SID> contains a State Value Name, a REG_DWORD data type, that is a bit mask whose value indicates the state of the local profile cache.The mask bits and their meaning are:

    Hex Mask    Description
     0001       Profile is mandatory.
     0002       Update the locally cached profile.
     0004       New local profile.
     0008       New central profile.
     0010       Update the central profile.
     0020       Delete the cached profile.
     0040       Upgrade the profile.
     0080       Using Guest user profile.
     0100       Using Administrator profile.
     0200       Default net profile is available and ready.
     0400       Slow network link identified.
     0800       Temporary profile loaded.

Resolution
  1. Logon with local admin profile. (or other account different that you want to use, but with admin privileges).
  2. Open regedit and go to HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList. Here you can see all SIDs of loaded profiles and probably you'll have some of them repeated but with .bak extensions.
  3. So if you want to recover your profile, desktop icons, ect... you only have to delete the profile with no .bak extension and rename the other, deleting only the .bak extension of it:
  4. Ex: In Regedit (HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList) I have:

    SID-1292428093-343818398-2115-158554 (1º Delete this Key)
    SID-1292428093-343818398-2115-158554.bak  (2º Rename This Key to SID-1292428093-343818398-2115-158554).
  5. Choose the renamed folder, in the right pane, double click RefCount and type 0 and then click OK.
  6. Choose the renamed folder, in the right pane, double click State and type 0 and then click OK.
  7. Restart your computer and Logon with the profile that you want to restore and that's all, your profile will be restored Perfectly.

Additional resources: 

Another fix involving Guid(s)

The fix is:
1. Login using another local administrator account. (Make one if there isn't another).
2. Remove the corrupted user from Users in control panel.
3. Move the corresponding folder from the Documents and Settings (XP) or Users folder (Vista and Windows7) to the desktop of the newly created admin user’s desktop.
4. Open regedit and navigate to HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList Find the key on the left that corresponds to the corrupted profile. Note the value of the string on the right called GUID. Delete all keys that list the corrupt user profile (.bak versions and regular).
5. THIS IS THE STEP THAT NEEDS TO BE ADDED TO KB:
Go up a few lines in regedit to HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileGuid.
6. Delete the key (keys?) within this ProfileGuid folder that match the value of the GUID string that you noted above.
7. Restart PC
8. Login as the temporarily created admin profile. Go to control panel and recreate the corrupted profile. (Make it an administrator at least temporarily so you’ll be able to access the files we moved to the other admin’s desktop if needed).
9. Logout and login as fixed user.
10. Copy any files from the temp admin’s desktop where we copied the corrupted profiles data, into the appropriate places in the fixed profile. This includes My Documents,Favorites, Outlook data, and any other user data you need.
11. Once everything is working properly, you can remove the temp admin from control panel> Users and delete its folder.

MAKE SURE YOU HAVE ALL OF THE DATA YOU NEED BEFORE REMOVING THE TEMP ADMIN.

GL!
9. Logout and login as recreated user.