How to Clear the Windows Delivery Optimization Cache using PowerShell

The Bandwidth Saver

Windows Delivery Optimization (DO) is a peer-to-peer sharing technology built into Windows 10 and 11. Instead of every PC in a corporate office downloading the exact same 4GB Windows Update payload directly from Microsoft’s servers, Delivery Optimization allows one PC to download the file and then silently share it with neighboring PCs over the local network (LAN).

While this significantly reduces external WAN bandwidth usage, the Delivery Optimization cache can become bloated. If a 128GB workstation is running out of disk space, or if a corrupted cached update is preventing a machine from successfully patching, system administrators must forcefully clear this specific hidden cache.

Locating the Cache

Unlike standard temporary files, the Delivery Optimization cache is heavily protected by the operating system and is located deep within the system drive:

C:\Windows\SoftwareDistribution\DeliveryOptimization

You cannot simply open File Explorer, navigate to this folder, and press delete. The background DoSvc (Delivery Optimization Service) is constantly running and actively locking the files. You must use PowerShell to safely purge the cache.

Using the Clear-DeliveryOptimizationCache Cmdlet

Microsoft provides a dedicated PowerShell module specifically for managing this peer-to-peer service. Because you are interacting with core Windows Update mechanics, you must run PowerShell with elevated Administrator privileges.

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

Clear-DeliveryOptimizationCache

The command executes silently. The background service is paused, the corrupted or bloated cache files are deleted from the hard drive, and the service resumes operation.

Clearing the Cache Remotely

If you are managing an entire fleet of computers via Windows Remote Management (WinRM), you can clear the Delivery Optimization caches on remote machines without interrupting the users.

Use the Invoke-Command cmdlet to push the instruction across the network. For example, to clear the cache on a workstation named DESKTOP-FIN-04:

Invoke-Command -ComputerName "DESKTOP-FIN-04" -ScriptBlock { Clear-DeliveryOptimizationCache }

Monitoring the Cache Size

If you want to verify that the cache was actually cleared, or if you want to audit a machine before blindly deleting files, you can query the exact size of the cache using the Get-DeliveryOptimizationStatus cmdlet.

Get-DeliveryOptimizationStatus | Measure-Object -Property TotalBytesDownloaded -Sum

This will output the exact number of bytes currently stored in the cache. Alternatively, you can use the built-in Get-DeliveryOptimizationPerfSnap cmdlet to view a highly detailed breakdown of how much data the machine has uploaded to its peers versus how much it has downloaded from Microsoft.

Get the best tech tips delivered straight to your inbox.

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