Please see below for solution 1, by skrysiak
Appears while attempting to logon in Windows Vista, 2008, 2008 R2 and 7.
The exact cause is unknown, but this issue may occur if the user profile was manually deleted by using the command prompt or Windows Explorer by a user or by some program. A profile that is manually deleted does not remove the security identifier (SID) from the user profile list in the registry. Since the SID is still present, Windows will still try to load the profile by using the ProfileImagePath that points to a nonexistent path. Therefore, the profile cannot be loaded.
This can also be a issue with the user profile entering into a backup state, or if the C:\Users\(User Name) user profile folder is manually renamed.
5 Steps total
Step 1: Log on to the Computer
Log on to the computer using the Administrator (or an Administrator-level) account.
If the computer is not joined to a domain, reboot it and start your computer in safe mode, then log on using the Administrator (or an Administrator-level) account.
Step 2: Trawl through the Registry
Open the Start menu. In the Start Search area, type regedit and press Enter (if prompted by UAC, click Continue/Yes). In regedit, go to:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList
Expand the ProfileList key and look for the SID key (named “S-1-5″…) with a long number that ends in “.bak”. Click it, and look at the ProfileImagePath value in the right pane to verify that this is the user account profile that has the error.
a) If you have two SID keys with the same number (with one ending in “.bak” and one showing the affected user account in the ProfileImagePath value), continue to Step 3;
b) If you have just one SID key with the ProfileImagePath value showing the affected user account, proceed to Step 4.
Step 3: Two SID keys with the same number
a) Of the two SID keys that corresponds to the affected user account, right-click the SID key that does NOT end in “.bak” and click Rename.
b) Add .bk to the end of the numbers and press Enter.
c) Right-click the other SID key that DOES end in “.bak” and click Rename.
d) Remove only .bak from the end of the numbers (so that it has the same name as the other SID key did before you renamed it) and press Enter.
e) Now go back and Rename the first one with .bk to .bak now at the end of the numbers and press Enter.
Proceed to Step 5…
Step 4: Only one SID key ending in “.bak”
a) Right-click the SID key that corresponds to the affected user account and click Rename.
b) Remove only .bak from the end of the numbers, and press Enter.
c) In the right pane, right-click the RefCount value (if none exists, right-click the right pane and click New and DWORD (32 bit) Value, then type RefCount and press Enter), and click Modify.
d) Type 0 into the Value Data textbox and click OK.
e) In the right pane, right-click the State value and click Modify.
f) Type 0 into the Value Data textbox and click OK.
Step 5: Try logging on again!
Close regedit and restart the computer. You should be able to logon now…
If still not working, see below for solution 2, by Helge Klein
Error Message Explained: User Profile Service Failed the Logon
This article is part of Helge’s Profile Toolkit, a set of posts explaining the knowledge and tools required to tame Windows user profiles.
Many errors related to user profiles result in the user getting a temporary profile instead of the regular local or roaming profile. I have written about possible causes for that here. In addition to that, there is an entirely different category of errors which occur when even a temporary profile cannot be created. This article describes the likely causes.
User Profile Service Failed the Logon
When Windows cannot even create a temporary profile you get to see the following error message:
The User Profile Service failed the logon. User profile cannot be loaded.
This typically happens when the default profile, stored in C:\Users\Default, has incorrect permissions or is corrupt in some way.
Default Profile Permissions
If all is well, the directory C:\Users\Default inherits permissions from its parent folder, C:\Users. This results in SYSTEM and Admninistrators having full control, while Users and Everyone have read permissions. In SetACL Studio this looks as follows:
The permissions for SYSTEM and Administrators are not relevant, but if for some reason the user logging on does not have read permissions on C:\Users\Default the error message User Profile Service Failed the Logon will be displayed and logging on is not possible.
When this happens the user profile service logs an event with ID 1509 and source User Profile General in the application event log:
Windows cannot copy file \\?\C:\Users\Default\ to location \\?\C:\Users\username\. This error may be caused by network problems or insufficient security rights.
DETAIL - Access is denied.
Default Profile Corrupt
Logon is not possible, either, if the default profile’s NTUSER.DAT file is nonexistent or corrupt.
If NTUSER.DAT does not exist the user profile service logs an event with ID 1500 and source User Profile Service in the application event log:
Windows cannot log you on because your profile cannot be loaded. Check that you are connected to the network, and that your network is functioning correctly.
DETAIL - The system cannot find the file specified.
If, on the other hand, NTUSER.DAT is corrupt the user profile service logs an event with ID 1508 and source User Profile Service in the application event log:
Windows was unable to load the registry. This problem is often caused by insufficient memory or insufficient security rights.
DETAIL - The system has attempted to load or restore a file into the registry, but the specified file is not in a registry file format.
for C:\Users\username\ntuser.dat
Fixing a Corrupt Default Profile
The easiest way to fix a corrupt default profile is to delete the content of C:\Users\Default and copy it from a working system. Make sure, though, that the machine you copy from has the same operating system version and language.