January 9, 2014

RDS and XenApp: How To Prune FontCache Files Under Windows ServiceProfiles Directory

I’m not sure exactly when this started on my Remote Desktop Service (RDS) and Citrix XenApp servers (because it wasn’t always a problem), but on both Windows Server 2008 R2 and Windows Server 2012 I’m seeing a large number of “FontCache” files in this specific location:

C:\Windows\ServiceProfiles\LocalService\AppData\Local

Again, this is only a problem on RDS and Citrix XenApp servers. Although it’s entirely possible it happens on other servers, the reason it’s a problem in RDS/XenApp environments is because a “FontCache” file is created for each unique user and these files are at least 8MB in size. If you have thousands of unique users, over time the space on the C: drive begins to fill up. We typically don’t allocate a ton of space for C: drives on these servers, so we’ve had a few instances where FontCache files completely filled the drive. The specific naming convention of these FontCache files is:

~FontCache-(SID)

Where (SID) is the Security Identifier Definition (without the parenthesis).

Originally I believed these files were being created by a Windows service called “Windows Presentation Foundation Font Cache 3.0.0.0.” But after disabling this service the files still appeared. So now it is apparent these files are being created by the standard “Windows Font Cache Service,” but I have yet to test disabling that service, and I do not yet know what (if any) problems that may cause. So try at your own risk!

But what you can do is manually delete these files from time to time or set up a Scheduled Task to do it for you. Below is the command you can run that will stop the service, delete the files, and start the service again.

net stop fontcache && del C:\Windows\ServiceProfiles\LocalService\AppData\Local\*.* /s /q & net start fontcache

The above command is a single line command even if it appears as more than one line in your web browser. Obviously you can split up the three individual commands (separated by ampersands, && and &) that make up this one long command. But if you are going to manually do this from time to time, it’s easier to copy and paste a single line command.

Sell Art Online

More information on the use of ampersands in commands:

Multiple Commands on a Single Line May Not Run When You Use the && Command Separator

Tweet about this on TwitterShare on Google+Share on FacebookShare on RedditPin on PinterestShare on TumblrDigg thisShare on StumbleUponShare on LinkedInEmail this to someone

Please share your thoughts

 

  • blackforce

    Thanks for the info

  • Bryan D.

    For some reason this issue started happening after we upgraded our 2008 R2 RDS farm from IE8 to IE11. Thanks for the explanation and fix, really appreciate it!