diff --git a/KillWindowsUpdate.ps1 b/KillWindowsUpdate.ps1 new file mode 100644 index 0000000..04c2326 --- /dev/null +++ b/KillWindowsUpdate.ps1 @@ -0,0 +1,49 @@ +# 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 \ No newline at end of file diff --git a/OptimizeVhdServices.ps1 b/OptimizeVhdServices.ps1 new file mode 100644 index 0000000..dd5b944 --- /dev/null +++ b/OptimizeVhdServices.ps1 @@ -0,0 +1,38 @@ +# OptimizeVhdServices.ps1 +# Wymaga uruchomienia z uprawnieniami Administratora +#Requires -RunAsAdministrator + +Write-Host "Wyłączanie usług Update i sprawdzania dysku..." -ForegroundColor Cyan +Write-Host "----------------------------------------------------" + +# 1. Wyłączanie mechanizmów aktualizacji +Write-Host "[1/2] Wyłączanie Windows Update (wuauserv) i UsoSvc..." -NoNewline +try { + # Najpierw siłowo zatrzymujemy usługi (jeśli działają) + Stop-Service -Name "wuauserv", "UsoSvc" -Force -ErrorAction SilentlyContinue + + # Zmieniamy tryb startu na "Wyłączony" + Set-Service -Name "wuauserv" -StartupType Disabled -ErrorAction Stop + Set-Service -Name "UsoSvc" -StartupType Disabled -ErrorAction Stop + + Write-Host " GOTOWE" -ForegroundColor Green +} catch { + Write-Host " BŁĄD" -ForegroundColor Red + Write-Host " Szczegóły: $_" -ForegroundColor Red +} + +# 2. Wyłączanie automatycznego sprawdzania dysku (Chkdsk) na partycji C: +Write-Host "[2/2] Wyłączanie auto-sprawdzania dysku C: (chkntfs)..." -NoNewline +try { + # Używamy natywnego narzędzia systemowego chkntfs + # Przełącznik /X oznacza "eXclude", czyli wyklucz podany dysk z autocheck + Start-Process -FilePath "chkntfs.exe" -ArgumentList "/x c:" -Wait -NoNewWindow + + Write-Host " GOTOWE" -ForegroundColor Green +} catch { + Write-Host " BŁĄD" -ForegroundColor Red + Write-Host " Szczegóły: $_" -ForegroundColor Red +} + +Write-Host "----------------------------------------------------" +Write-Host "Optymalizacja VHD zakończona!" -ForegroundColor Cyan \ No newline at end of file