Skip to content

Instantly share code, notes, and snippets.

@st1vms
Last active August 14, 2025 09:18
Show Gist options
  • Save st1vms/079ae8d2eccd6d471ebee66df6beb1a8 to your computer and use it in GitHub Desktop.
Save st1vms/079ae8d2eccd6d471ebee66df6beb1a8 to your computer and use it in GitHub Desktop.
Disable Windows Delivery Optimization service (DoSvc)
Script to create a task that disables and stops the Windows DoSvc service on startup
@echo off
set "pwshPath=C:\Program Files\PowerShell\7\pwsh.exe"
set "scriptPath=C:\disable_dosvc.ps1"
schtasks /create ^
/tn "DisableDoSvc" ^
/tr "\"%pwshPath%\" -ExecutionPolicy Bypass -File \"%scriptPath%\"" ^
/sc onstart ^
/RL highest ^
/ru SYSTEM
@pause
# Disables DoSvc by stopping it on startup and setting Start value to 4
$regPath = "HKLM:\SYSTEM\CurrentControlSet\Services\DoSvc"
$serviceName = "DoSvc"
if (Get-Service -Name $serviceName -ErrorAction SilentlyContinue) {
Stop-Service -Name $serviceName -Force -ErrorAction Stop
do {
Start-Sleep -Seconds 1
$status = (Get-Service -Name $serviceName).Status
} while ($status -ne 'Stopped')
}
Set-ItemProperty -Path $regPath -Name "Start" -Value 4
icacls "C:\disable_dosvc.ps1" /inheritance:r
icacls "C:\disable_dosvc.ps1" /grant:r SYSTEM:F Administrators:R
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment