User profile cannot be loaded with Event ID 1509, DETAIL - The filename or extension is too long

SYMPTOM

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

\\server\stuprofiles$\mandatory\usstudent.V2\AppData\Local\Microsoft\Windows\Temporary Internet Files\Low\Content.IE5\1240I065\rerB_DjUStFFe16SFEk84lWs2Osh6fwMPJxC1rA8Qwo3EktjoDVd_D0iWDKfepWLE.u7QlPbk.LXlOspXArg7uJna_L8I4Pwi6RfmQLZSAeLvyy0aLgws4xxKwEDnFCvly9zCn9yGMH5Tmf1_yA2fnT[1].M- to location C:\Users\usstudent\AppData\Local\Microsoft\Windows\Temporary Internet Files\Low\Content.IE5\1240I065\rerB_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.

CAUSE

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

RESOLUTION

Use one of the methods to resolve it:

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:

1) In Internet Explorer, click Internet Options on the View (or Tools) menu.

2) Click the Advanced tab.

3) 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.

4) Click OK.

2. Create a script to delete the file under temporary files. Here is an example:

strFolder = "C:\Documents and Settings\LocalService\Local Settings\Temporary Internet Files\Content.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

Else

File.Delete

End If

Next

For each Folder in objSubFolders

FRecurse Folder

Next

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

Folder.Delete

Next

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"

 

REFERENCES

https://social.technet.microsoft.com/Forums/en/w7itproui/thread/9e22409c-d671-46fd-a67f-401be6ed40a1

https://social.technet.microsoft.com/Forums/en-US/w7itprogeneral/thread/cdc917a6-ee37-4c7c-b4ed-f9c73d27b593

https://social.technet.microsoft.com/Forums/en-US/w7itproui/thread/a38a8a6a-050b-4590-a49d-499706690801

https://social.technet.microsoft.com/Forums/en-US/winserverTS/thread/b1b7ed88-387a-4075-a7b2-2eddf379a916

Comments

  • Anonymous
    January 01, 2003
    You can use Long Path Tool as well, it works good for such issues.
  • Anonymous
    January 06, 2013
    The comment has been removed
  • Anonymous
    December 07, 2014
    Hey there,
    check out Long Path Tool to solve your problem.
  • Anonymous
    October 13, 2015
    Try to long path tool. It is very helpful.
  • Anonymous
    October 13, 2015
    Try to long path tool. It is very helpful.
  • Anonymous
    October 27, 2015
    Try " Long Path Tool " is also useful in situations where you see these error messages