Files
skrypty_windows/KillWindowsUpdate.ps1
T
2026-07-21 14:02:01 +02:00

49 lines
2.0 KiB
PowerShell

# KillWindowsUpdate.ps1
# Wymaga uruchomienia z uprawnieniami Administratora
#Requires -RunAsAdministrator
Write-Host "Trwa ostateczne pacyfikowanie Windows Update w rejestrze..." -ForegroundColor Cyan
Write-Host "----------------------------------------------------"
# 1. Zablokowanie Windows Update Medic Service (WaaSMedicSvc)
Write-Host "[1/3] Blokowanie usługi WaaSMedicSvc..." -NoNewline
try {
$medicPath = "HKLM:\SYSTEM\CurrentControlSet\Services\WaaSMedicSvc"
if (Test-Path $medicPath) {
Set-ItemProperty -Path $medicPath -Name "Start" -Value 4 -Type DWord -Force
Write-Host " GOTOWE" -ForegroundColor Green
} else {
Write-Host " BRAK KLUCZA" -ForegroundColor Yellow
}
} catch {
Write-Host " BŁĄD" -ForegroundColor Red
}
# 2. Polityka GPO: NoAutoUpdate = 1
Write-Host "[2/3] Wymuszanie braku aktualizacji przez polityki (NoAutoUpdate)..." -NoNewline
try {
$auPath = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU"
if (-not (Test-Path $auPath)) {
New-Item -Path $auPath -Force -Recurse | Out-Null
}
Set-ItemProperty -Path $auPath -Name "NoAutoUpdate" -Value 1 -Type DWord -Force
Write-Host " GOTOWE" -ForegroundColor Green
} catch {
Write-Host " BŁĄD" -ForegroundColor Red
}
# 3. OPCJA NUKLEARNA: Usunięcie kluczy usług (Odkomentuj, jeśli chcesz tego użyć)
# Zastosowanie tego sprawi, że usługi całkowicie znikną z systemu.
<#
Write-Host "[3/3] Usuwanie usług wuauserv i UsoSvc z rejestru..." -NoNewline
try {
Remove-Item -Path "HKLM:\SYSTEM\CurrentControlSet\Services\wuauserv" -Recurse -Force -ErrorAction SilentlyContinue
Remove-Item -Path "HKLM:\SYSTEM\CurrentControlSet\Services\UsoSvc" -Recurse -Force -ErrorAction SilentlyContinue
Write-Host " GOTOWE (Usunięto)" -ForegroundColor Green
} catch {
Write-Host " BŁĄD" -ForegroundColor Red
}
#>
Write-Host "----------------------------------------------------"
Write-Host "Zablokowano. Pamiętaj o restarcie systemu!" -ForegroundColor Cyan