For those of you using BranchCache, for example to reduce the network impact Windows 10 will have on your environment, I highly recommend changing the size and default for the BranchCache Publication Cache. Why you ask? Well, the default settings are just not good enough.
Background Info
In the Windows 10 era, especially when starting to implement BranchCache with ConfigMgr, and/or enabling DOINC too, you're going to find that the BranchCache publication cache can grow to several GB. The thing is, the default size is 1% of the OS volume, and it's obviously stored on the OS volume to. That means if your DP's have a 60 GB OS volume, the default publication size is going to be 0.6 GB, which is simply not enough.
Moving the Publication Hash Cache
To move the BranchCache Publication Cache to a data disk / volume, and set the size, simply run the below little PowerShell snippet.
Credits: Big thanks to Phil Wilcock for syntax help, and for this blog post: https://2pintsoftware.com/resizing-the-branchcache-cache-powershell/
$NewHashFolder = "E:\BCPublicationCache"
$NewHashSize = 10GB
New-Item -Path $NewHashFolder -ItemType Directory
$BCCache = Get-BCStatus
Set-BCCache -Path $BCCache.HashCache.CacheFileDirectoryPath -MoveTo $NewHashFolder -Force
$BCHashCache = Get-BCHashCache
$BCHashCache | Set-BCCache -SizeBytes $NewHashSize -Force
Or you can set it for percent of a disk:
$NewHashFolder = "E:\BCPublicationCache"
$NewHashSizeInPercent = 5
New-Item -Path $NewHashFolder -ItemType Directory
$BCCache = Get-BCStatus
Set-BCCache -Path $BCCache.HashCache.CacheFileDirectoryPath -MoveTo $NewHashFolder -Force
$BCHashCache = Get-BCHashCache
$BCHashCache | Set-BCCache -Percentage $NewHashSizeInPercent -Force
Verifying the configuration
To verify the configuration, simply run the Get-BCHashCache PowerShell cmdlet.

Supporting legacy servers
For those of you still running Windows Server 2008 R2 (you really shouldn't have them anymore), here is the netsh version that you can run in your favorite console (Command Prompt, PowerShell, Windows Terminal).
Note: These commands will actually delete the existing cache, and sometimes you will have to stop the BranchCache service for the set publicationcache part to work).
netsh branchcache flush
md E:\BCBranchCache
netsh branchcache set publicationcache directory=E:\BCBranchCache
netsh branchcache set publicationcachesize 10737418240
Or you can set it for percent of a disk:
netsh branchcache flush
md E:\BCBranchCache
netsh branchcache set publicationcache directory=E:\BCBranchCache
netsh branchcache set publicationcachesize size=10 percent=TRUE
Thanks for the post.
Is there a way to run the flush command on the remote computer ( net branchcache flush)?
For the clients you can either use netsh branchcache flush, or the PowerShell command: Clear-BCCache -Force
/ Johan
Hello,
What about the data cache location/size. Should this be moved/changed or perhaps it doesn't matter?
if your clients have multiple volumes disks (not recommended), yes then the data cache can be re-located, but usually you don't.
Hi.
Is Publication Hash Cach used for packages that Branchcache enabled clients have the opportunity to share? I didn't think the server needed to store anything in the cache, only that the clients had the packages in their cache to share within same subnet.
The Publication Cache holds the CI (checksum) of all files clients are requesting, and unless you have data deduplication enabled, or have pre-generate the hash in other ways (PowerShell), if it's the first time a client is requesting a file, a new CI is generated for it. The clients are using the checksum to ask their friends on the local network for content. / Johan
Hi Johan can the location of Publication Hash Cache reside on a deduped volume?
Should be fine as long as you exclude the publication hash cache folder from the deduplication process. / Johan