Поделиться через


A Corrupted or Missing Profile Problem

This isn't really a deployment issue, but it seems to crop up often enough with my customers (and occasionally family and friends) that I thought I would write about it.

A user would report that when they tried to log on they got a message that said "The User Profile Service Failed The Logon.  User Profile Could Not Be Loaded" or they got a dialog box near the end of the logon sequence like this:

If they got the first message, they were taken back to the logon prompt.  If they got the second message, the logon would complete, but none of their user settings would be loaded (they would have to reconfigure Outlook, reset their IE homepage, reset their background image etc.).  Rebooting the computer did not fix the problem.

This problem is particularly frustrating for users because it seems to have come out of the blue.

The user profile consists of a local directory (folder) on the hard drive and a collection of settings in the computer's registry.  The profile folder contains all of that user's files (everything in My Documents, My Pictures, My Videos, Desktop, Downloads etc.).  If you want to really ruin someone's day, delete this directory and note that all those files they have stored on their desktop are gone (everyone stores stuff on their desktop, right?).  These folders are usually stored in C:\Users (Windows Vista and Windows 7) or C:\Documents and Settings (Windows XP).  The contents of the profile folder are created the first time the user logs onto a computer by copying the default user profile folder and renaming it to match the username.

This problem is nearly always caused by a mismatch between the actual name/location of this folder and the name/location stored in the registry.

The first image below is part of the HKLM hive of the registry of my lab computer (click on the image to see a higher resolution picture).  Each of the keys on the left that begin with "S-1-5" correspond to a user.  The first three are profiles for system accounts.  The ones with all the digits after them are user accounts for users that have logged onto the system.

 

The path to this part of the registry is shown at the bottom of the graphic.

Notice that the ProfileImagePath value is set to "C:\Users\Brucelan".  This is as it should be, since that is the correct name and location for my profile folder.  If I renamed/moved/deleted that folder, Windows is still going to try to load that profile and will fail.

This next image shows another user's profile information on my computer.  This user is getting the "You have been logged on with a temporary profile" message.

Here is the directory structure on my computer where the profiles are stored:

Do you see the problem?

Windows thinks the profile folder is called "Wilber Post" but the real folder name is "Wilber Post1".  I changed the name of the folder to create the problem.  The next time Wilber Post logged on to the computer, Windows tried to load his profile (it thought it was going to be available at "C:\Users\Wilber Post").  Windows found no folder there so it created a temporary profile to allow the logon to continue.  Windows then appended .bak to the profile key that failed to load.  Every time that Wilber Post tries to logon, Windows will now load a new temporary profile with settings copied from the default user profile.

To fix the problem, log on as an administrator, launch regedit and change the ProfileImagePath value in the key that ends in ".bak" to match the actual profile folder name.  Alternatively, you can change the name of the profile to match the ProfileImagePath value in the key that ends in ".bak".  After you fix the mismatch, change the key name that does not have ".bak" in it by adding an extension such as ".old".  Then remove the ".bak" extension from the correct profile key.

 The next time the user logs on, the profile path will match and Windows will not create a temporary profile.

What if the profile folder was deleted from the C:\Users directory?  In this case, simply make a copy of the default user profile directory and rename it to the user's name (verify that it matches the ProfileImagePath in the registry).  You will have to remove the ".bak" extension as explained above too.

 There is one more scenario that you may encounter related to this problem.  What happens if you are the only administrator on the computer and you receive the dreaded "The User Profile Service Failed the Logon" message?  This problem can occur if the computer was not shutdown properly.  The problem is the same (Windows has added ".bak" to the name of the profile key).  In this case you can't logon so how do you fix the problem if you are the only administrator?  The answer is Windows Safe Mode.  When you use Safe Mode, the profile will not be loaded so you should be able to logon and launch regedit and remove the ".bak" extension.  To start the computer in Safe Mode, restart the computer and hold down the F8 key during the start up sequence.

So far I have skipped over how the mismatch problem occurs in the first place.  The most common scenario I have seen is untrained users/administrators who move/delete a profile folder in C:\Users.  At one customer, it was common for users to go on extended trips away for the office (six months or more).  One administrator there would helpfully delete profile folders for users that were away on individual computers to "clean up some space".  When the user returned, they would logon and get the temporary profile because the registry key for their account was still there but the profile folder was gone.  Once I showed the administrators how to properly remove a profile from a computer this problem didn't occur again.

The correct way to change\delete a profile is to use the control panel (System>Advanced System Settings>Users>Settings):

 I hope this helps anyone who may have run into this problem.

-bruce

Comments

  • Anonymous
    April 30, 2014
    Thank you for your advice Bruce. Helped out a client. :)
  • Anonymous
    August 14, 2014
    Thanks a bunch dude!
  • Anonymous
    November 22, 2014
    ahh i think this actually worked!
    i dont understand any of the computer language stuff, but the pictures helped
    thank you so much
  • Anonymous
    December 17, 2014
    Thank you very much, it worked
  • Anonymous
    December 20, 2014
    Thank you! A suggestion for the last sentences - change word "Users" to "User Profiles".

    Do other editions of Windows have different methods?

    My suggestion:
    "The correct way to changedelete another user profile is:
    Login as an administrator-level account,
    Open Control Panel:
    Windows 7 (System>Advanced System Settings>User Profiles>Settings)
    Windows 8.1 (????????)
    "

    -- instead of

    "The correct way to changedelete a profile is to use the control panel
    (System>Advanced System Settings>Users>Settings):"
  • Anonymous
    January 08, 2015
    thanks so much Bruce
  • Anonymous
    January 18, 2015
    Very, very helpful.
  • Anonymous
    July 13, 2015
    What if .bak is missing from the end of the S-1-5 string of numbers? And there is nothing in the right pane that says ProfileImagePath???