How to Clear the Windows BranchCache using the Clear-Bccache Cmdlet

Understanding BranchCache

In a distributed enterprise network, bandwidth is often a precious commodity. If a company has a central headquarters in New York and a small branch office in rural Texas connected via a slow WAN link, you do not want all 50 employees in Texas downloading the exact same 2GB Windows Update directly from the New York server simultaneously. It will completely saturate the WAN connection.

Microsoft solved this with BranchCache. When the first employee in Texas requests the 2GB file from New York, it downloads over the slow WAN. However, BranchCache caches that file locally in Texas (either on a dedicated local server or distributed across the peers). When the second employee requests the identical file, they pull it instantly from the local cache rather than the WAN.

While incredibly efficient, the cache can become bloated or corrupted. If a file was updated in New York but the Texas office is stubbornly holding onto the old cached version, a system administrator must forcefully clear the local BranchCache to force a fresh pull from the central server.

Using the Clear-Bccache Cmdlet

PowerShell provides a dedicated module for managing this feature. To interact with the BranchCache service, you must open PowerShell with elevated Administrator privileges on the specific machine (or local branch server) holding the cache.

To forcefully purge the entire BranchCache repository on the local machine, execute the following command:

Clear-Bccache -Force

The -Force parameter bypasses the “Are you sure?” confirmation prompt, making it ideal for automated maintenance scripts. The command executes silently, and the entire local cache directory is instantly wiped.

Clearing Specific Cache Types

BranchCache actually stores two distinct types of data: the actual file payload (the Data Cache) and the cryptographic hashes used to verify the integrity of the files (the Hash Cache). If you are troubleshooting a severe corruption issue, you can clear them individually.

To clear only the raw data while leaving the hash verification tables intact:

Clear-Bccache -CacheType Data

To clear only the cryptographic hashes:

Clear-Bccache -CacheType Hash

Verifying the Cache is Empty

After running the clear command, it is best practice to verify that the cache size has actually dropped to zero. You can query the current status of the BranchCache service using the Get-BcStatus cmdlet.

Get-BcStatus

This will output a massive configuration table. Look for the DataCache and HashCache sections. You should see that the CurrentActiveCacheSize and CurrentCacheSize values have dropped to 0 Bytes, confirming that your purge was successful and the machine is ready to pull fresh data from the headquarters WAN link.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.