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