This article can help if when logging in to a computer with or without a domain and the error message is something that looks like: "Windows cannot find the local profile and is logging you on with a temporary profile. Changes you make to this profile will be lost when you log off."

The event is also registered under event viewer < application < userenv source.
So what can we do?
 
1.   First situation goes for a temporary user that was created if an error occurred trying to load the basic user. In this case you can start the computer in safe mode < go to computer properties < advanced < user profiles < try to search for something like "temp profile" < delete this profile < logoff and login.
2.   Try system restore from accessories < system tools.
3.   In cases this errors occur when logging to domain, try to see what the problem in user properties is (in active directory). If the user is a roaming user, this error happens when the user profile path is not configured right, modified or the folder permissions was change so that the user can’t write to this folder (write permissions must be set as the user profile load to and from the server in order to save all documents, applications etc.).
4.   In cases this errors occur when logging to domain, try to check if the server’s disk that holds the roaming profile has enough disk space. If there is a lake on disk space, the profile can’t load and provides this error.
5.   Check if the user exists in system (c:\documents and settings\username). In this case you can go to registry and delete the sid.bak from this path:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList
Now logoff and login to computer.