Created
August 6, 2025 00:46
-
-
Save lundman/73040166d820a91060a789108f2cf7c9 to your computer and use it in GitHub Desktop.
Kill Windows Update processes and services
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# kill-updates-precise.ps1 | |
# | |
# So what is going on here? While developing my kernel driver for Windows | |
# I have found the fastest way is to have the target VM set up, and | |
# be ready for drvier to be deployed in a snapshot, deploy driver, test, | |
# then rollback VM. | |
# | |
# Sadly, when Windows is restored at each rollback, it kicks of a series of | |
# update checks, like Windows Updater, Edge, OneDriver, Google etc. | |
# It is not enough to disable Windows Update, or Group Policy. | |
# | |
# Sure they waste bandwidth, and slows down the VM, only to be wiped out | |
# when I roll back the VM. But that isn't the main reason... | |
# | |
# When the Updaters run, they hold the Setup lock. | |
# | |
# To deploy your kernel driver, it needs the Setup lock. | |
# | |
# So when any of the Update processes run, you can not Deploy your | |
# driver. Of course, you can let the update happen, create a new | |
# snapshot etc. But. there. are. so. many. updates. | |
# | |
# But, instead Gemini and I cooked up this PowerShell script. Run | |
# as Administrator, start it before you snapshot. And enjoy | |
# debugging your drivers in peace. | |
# List of services to terminate that are causing issues | |
$servicesToKill = @( | |
"wuauserv", # Windows Update Service | |
"BITS", # Background Intelligent Transfer Service | |
# "UsoSvc", # Update Orchestrator Service | |
"dosvc", # Delivery Optimization | |
"WaaSMedicSvc" # Windows Update Medic Service | |
) | |
# List of standalone processes to kill | |
$processesToKill = @( | |
"CompatTelRunner.exe", | |
"usoclient.exe", | |
"MoUsoCoreWorker.exe", | |
"TiWorker.exe", | |
"OneDrive.exe", | |
"GoogleUpdate.exe", | |
"GoogleUpdateCore.exe", | |
"msiexec.exe" | |
) | |
Write-Host "Monitoring for unwanted update processes and services..." | |
while ($true) { | |
# --- Check for and stop specific services --- | |
foreach ($serviceName in $servicesToKill) { | |
try { | |
$service = Get-Service -Name $serviceName -ErrorAction SilentlyContinue | |
if ($service -and $service.Status -eq 'Running') { | |
Write-Host "Found running service '$serviceName'. Attempting to stop..." -ForegroundColor Yellow | |
Stop-Service -Name $serviceName -Force | |
Write-Host "BOOM Headshot! '$serviceName'." -ForegroundColor Green | |
} | |
} catch { | |
Write-Host "Failed to stop service '$serviceName'. Error: $($_.Exception.Message)" -ForegroundColor Red | |
} | |
} | |
# --- Check for and stop specific processes --- | |
foreach ($processName in $processesToKill) { | |
$process = Get-Process -Name $processName -ErrorAction SilentlyContinue | |
if ($process) { | |
Write-Host "Found process '$processName' (PID: $($process.Id)). Attempting to terminate..." -ForegroundColor Yellow | |
try { | |
Stop-Process -Name $processName -Force -ErrorAction Stop | |
Write-Host "BOOM Headshot! '$processName'." -ForegroundColor Green | |
} catch { | |
Write-Host "Failed to terminate '$processName'. Error: $($_.Exception.Message)" -ForegroundColor Red | |
} | |
} | |
} | |
Start-Sleep -Seconds 5 | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment