How to Configure Delivery Optimization Cache and Peering in Windows 11 Using PowerShell

In enterprise branch offices, home laboratories, and bandwidth-constrained networks, multiple Windows 11 workstations downloading gigabytes of cumulative monthly updates, Microsoft Store apps, and Microsoft 365 packages simultaneously can saturate WAN internet connections. Microsoft addresses this through Delivery Optimization (DO). Delivery Optimization is a peer-to-peer cloud-managed content delivery system that allows local workstations on the same local area network (LAN) or Active Directory site to download updates directly from neighboring peers rather than hitting Microsoft cloud servers repeatedly. IT administrators can inspect, tune, and enforce Delivery Optimization policies using PowerShell.

Understanding Delivery Optimization Download Modes

Delivery Optimization operates in several distinct peering modes (DODownloadMode):

  • 0 (HttpOnly): Peering disabled. All content is fetched directly over HTTPS from Microsoft update servers.
  • 1 (LAN): Peering enabled exclusively across the local subnet or local broadcast domain. Workstations share update caches with local peers behind the same NAT router.
  • 2 (Group): Peering restricted to devices belonging to a designated Active Directory Domain Services site or custom Group ID GUID.
  • 3 (Internet): Peering enabled across both local LAN devices and verified external internet peers.
  • 99 (Simple): Completely isolates download operations without cloud coordination (used in air-gapped environments).
  • 100 (Bypass): Bypasses the Delivery Optimization service completely, routing through standard BITS (Background Intelligent Transfer Service).

Auditing Active Delivery Optimization Performance with PowerShell

Windows includes native PowerShell cmdlets to analyze Delivery Optimization efficiency and peering savings:

# Query aggregate Delivery Optimization performance statistics
Get-DeliveryOptimizationStatus | Select-Object FileId, FileSize, TotalBytesDownloaded, PercentPeerCaching, DownloadMode | Format-Table -AutoSize

# Inspect total bandwidth saved from local peers
Get-DeliveryOptimizationPerfSnap

The Get-DeliveryOptimizationPerfSnap command returns essential bandwidth efficiency telemetry:

  • TotalBytesFromPeers: Number of bytes sourced from local peer computers.
  • TotalBytesFromHttp: Number of bytes downloaded across external WAN connections from Microsoft CDN.
  • PeerCachePercentage: The proportion of total content served via local peer caching.

Configuring Download Modes and Cache Age via PowerShell

Delivery Optimization settings are configured through the Windows Registry or MDM policies. To establish an optimal LAN peering profile via PowerShell:

$doPath = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\DeliveryOptimization"
if (!(Test-Path $doPath)) {
    New-Item -Path $doPath -Force | Out-Null
}

# 1. Set Download Mode to 1 (LAN Peering)
Set-ItemProperty -Path $doPath -Name "DODownloadMode" -Value 1 -Type DWord

# 2. Set Minimum Peer Caching File Size to 10 MB (files smaller than 10MB bypass DO)
Set-ItemProperty -Path $doPath -Name "DOMinFileSizeToCache" -Value 10 -Type DWord

# 3. Retain cached update packages for up to 7 days (604800 seconds)
Set-ItemProperty -Path $doPath -Name "DOMaxCacheAge" -Value 604800 -Type DWord

# 4. Limit cache drive usage to 20% of free disk capacity
Set-ItemProperty -Path $doPath -Name "DOMaxCacheSize" -Value 20 -Type DWord

Write-Host "Delivery Optimization LAN peering policies successfully enforced." -ForegroundColor Green

Configuring Bandwidth Throttling for Background Updates

To prevent update downloads from competing with critical business traffic during operational hours, apply background bandwidth limits:

$doPath = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\DeliveryOptimization"

# Limit background downloads to 30% of total available connection bandwidth
Set-ItemProperty -Path $doPath -Name "DOMaxBackgroundDownloadBandwidth" -Value 30 -Type DWord

# Set absolute maximum upload bandwidth to peers (e.g. 2000 KB/s = ~2 MB/s)
Set-ItemProperty -Path $doPath -Name "DOMaxUploadBandwidth" -Value 2000 -Type DWord

Clearing the Local Delivery Optimization Cache

If you need to free up local disk space or purge corrupted cache fragments during testing:

# Stop the Delivery Optimization service
Stop-Service -Name "DoSvc" -Force

# Delete the contents of the DO cache folder
Remove-Item -Path "C:\Windows\ServiceProfiles\NetworkService\AppData\Local\Microsoft\Windows\DeliveryOptimization\Cache\*" -Recurse -Force -ErrorAction SilentlyContinue

# Restart the service
Start-Service -Name "DoSvc"

Configuring Delivery Optimization via PowerShell ensures predictable bandwidth consumption, accelerates Windows update deployment, and reduces branch-office WAN traffic across Windows 11 fleets.

Get the best tech tips delivered straight to your inbox.

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