User profile cannot be loaded with event ID 1509, 1504

This is a user profile issue.

Some clients log on with temporary profile with error “User Profile Service failed the logon.  User profile cannot be loaded”. Event id 1509 can be found in the application event log. The detail of the event id 1509 is something like below:

EventID 1509:
Windows cannot copy file \serverstuprofiles$mandatoryusstudent.V2AppDataLocalMicrosoftWindowsTemporary Internet FilesLowContent.IE51240I065rerB_DjUStFFe16SFEk84lWs2Osh6fwMPJxC1rA8Qwo3EktjoDVd_D0iWDKfepWLE.u7QlPbk.LXlOspXArg7uJna_L8I4Pwi6RfmQLZSAeLvyy0aLgws4xxKwEDnFCvly9zCn9yGMH5Tmf1_yA2fnT[1].M- to location C:UsersusstudentAppDataLocalMicrosoftWindowsTemporary Internet FilesLowContent.IE51240I065rerB_DjUStFFe16SFEk84lWs2Osh6fwMPJxC1rA8Qwo3EktjoDVd_D0iWDKfepWLE.u7QlPbk.LXlOspXArg7uJna_L8I4Pwi6RfmQLZSAeLvyy0aLgws4xxKwEDnFCvly9zCn9yGMH5Tmf1_yA2fnT[1].M-. This error may be caused by network problems or insufficient security rights.
DETAIL - The filename or extension is too long.




This can happen if the destination path of the users profile is on a server with a long server and sharename, e.g. \servernamethisistheprofileshare As the file is stored locally on "c:usersusername" the filename for copying to the destination will increase when this prefix is changed to "\servernamethisistheprofileshare" leading to a pathname longaer than the supported 260 chars.

We found several resolutions, choose one of them will fix this issue:


1.    You can use the " Empty Temporary Internet Files folder when browser is closed " option in Internet Explorer to delete all cached Internet files when a user quits Internet Explorer. This option does not delete cookie information. Cookie information (which is usually small) is copied when the profile is saved. To use this option, follow these steps:

In Internet Explorer, click Internet Options on the View (or Tools) menu.
Click the Advanced tab.
Under Security, click the "Delete saved pages when browser closed" or "Empty Temporary Internet Files folder when browser is closed" check box to select it.
Click OK.

2.    Create a script to delete the file under temporary files . Here is the script below

strFolder = "C:Documents and SettingsLocalServiceLocal SettingsTemporary Internet FilesContent.IE5"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolders = objFSO.GetFolder(strFolder)
FRecurse objFolders
DRecurse objFolders
Sub FRecurse(ByRef objFolders)
    Set objSubFolders = objFolders.SubFolders
    Set objFiles = objFolders.Files
    For each File in objFiles
 If LCase(File.Name) = "index.dat" Then
 End If
    For each Folder in objSubFolders
        FRecurse Folder
    Set objSubFolders = Nothing
    Set objFiles = Nothing
End Sub
Sub DRecurse(ByRef objFolders)
    Set objSubFolders = objFolders.SubFolders
    Set objFiles = objFolders.Files
    For each Folder in objSubFolders
    Set objSubFolders = Nothing
    Set objFiles = Nothing
End Sub
You can also integrate this with task scheduler to run it regularly and ensure you web client cache is flushed regularly.
3.    Enable GPO "Deleted cached copies of roaming profiles"



Starting January, 2011, the customers reported some of users with roaming profiles having trouble logging onto their XP machines.  When a user tries to log in they get an error message stating:

"Windows cannot copy file C:Documents and SettingsusernameCookiesfilename.txt to location \servernameprofiles$usernameCookiesfilename.txt.  Possible causes of this error include network problems or insufficient security rights.  If this problem persists, contact your network administrator.

DETAIL - Access is denied"

Windows then logs the user in with a temp local profile and the user's settings from the roaming profile does not get loaded.

Looks like this problem caused by Macfee according to the post
First, please check if you have the latest 5.2.1 version of the McAfee software. As this issue is being resolved for a lot of Customers using the new version.
If you are still facing the issue, please follow the below step.
Disable the cookie scanning from the registry :
HK_Local_machinesoftwareMcafeeSystemCoreVSCoreOn Acess ScannerMchieldConfiguration . The Dword is “ScanCookies” , the default value is “ 1” , change it to “0”






Comments (8)

  1. Erik Hoenderdos says:

    I'm expierencing this problem at multiple computers and on different domains. Is there a fix comming up from microsoft which solves this problem? I mean a fix which makes shure the files aren't created anymore?

  2. Richard says:

    The suggested resoltions are mere workarounds. The real solution would be if the Windows processes that do the copying would use the Unicode functions that have a limit of 32,767 characters as explained in…/aa365247(v=vs.85).aspx

  3. Michael van Zomeren, SkylarNET says:

    Hello All…

    It has been for over a year now since McAfee set us up with this annoying defect in their software and still no suitable solution!

    I serve several customers with McAfee in client/server and terminal Server environments and still having problems with roaming profiles.

    Also the Online back-up solutions we use with rSync are being affected.

    So I decided to try figure this out and come up with a solution that works.

    Been to all the forums, spoke to McAfee, since we have Gold Support and all… No luck.

    Patches, registry tweaks, you name it… It does not work!

    Then I decided to figure out how to exclude these annoying cookies from being scanned…

    This is what I came up with and it works!  Finally!

    Setup your policies with wildcards ** to exclude folders containing cookies.

    For Windows XP and Server 2003:

    Folder:  C:Documents and Settings**Cookies

    For Windows 7 and Server 2008:

    Folder:  C:Users**AppDataRoamingMicrosoftWindowsCookies

    The ** means to exclude all folders it comes across form the folder “Documents and Settings” or “Users”

    In other words, this applies for all users on the workstation or server.

    I also excluded the shares profile folder on the server for my online back-up:

    For Windows 7:  F:Profile**AppDataRoamingMicrosoftWindowsCookies

    For Windows XP:  F:profile**Cookies

    Also the shared UNC path is excluded:

    For Windows 7:  \ServerNameprf$**AppDataRoamingMicrosoftWindowsCookies

    For Windows XP:  \ ServerNameprf$**Cookies

    But be aware, double wildcards for folders does not seem to work, eg.

    \ ServerNameprf$****Cookies

    I tried this on my provisioned Terminal Server, witch is shared with more company’s.

    \ ServerNameprf$Company1UsernameCookies

    \ ServerNameprf$Company2UsernameCookies

    \ ServerNameprf$Company3UsernameCookies

    It’s not a very neat solution because no cookies get scanned anymore by McAfee, but in my humble opinion, cookies aren’t that harmful in this case.

    I sure hope McAfee can come up with a more subtle solution than this, but I kind of lost hope after a year!

    I hope I can help fellow system administrators with this solution.

    Michael van Zomeren


  4. Error 1504 Windows 7 Profile says:


    I am having an issue with a users roaming profile. He is changing his desktop and its not saving back on the file server.  Ive checked the permissions which are all correct but he is getting errors replationg to shared objects through his profile.  Is there now a fix for this.

  5. Barney says:

    My scenario is little different.

    I have a new GPO and remote profile. If user have local account and I apply new policy everything is ok. But i cannot log a new user who never log in to domain. I think there is a problem because the user have no profile, so it cannot be copied. So: how this user can log in ???????  

  6. Vimod says:

    Restart will resolve this issue….

  7. SteveAD says:

    Well, you can use long path tool for such problems, it works good I will say.

  8. Artur says:

    Try using Long Path Tool program.

Skip to main content