Files
winutil/functions/public/Invoke-WPFUpdatesdisable.ps1
T

57 lines
2.2 KiB
PowerShell
Raw Normal View History

+3
2023-03-07 12:28:00 -08:00
function Invoke-WPFUpdatesdisable {
<#
2023-10-19 17:12:55 -05:00
.SYNOPSIS
Disables Windows Update
.NOTES
Disabling Windows Update is not recommended. This is only for advanced users who know what they are doing.
+3
2023-03-07 12:28:00 -08:00
#>
2026-01-08 21:04:36 +02:00
$ErrorActionPreference = 'SilentlyContinue'
2025-09-16 19:04:11 +02:00
2025-09-05 09:27:26 -05:00
Write-Host "Configuring registry settings..." -ForegroundColor Yellow
2026-01-08 21:04:36 +02:00
New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" -Force
2025-09-16 19:04:11 +02:00
+3
2023-03-07 12:28:00 -08:00
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" -Name "NoAutoUpdate" -Type DWord -Value 1
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" -Name "AUOptions" -Type DWord -Value 1
2025-09-16 19:04:11 +02:00
2026-01-08 21:04:36 +02:00
New-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\DeliveryOptimization\Config" -Force
+3
2023-03-07 12:28:00 -08:00
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\DeliveryOptimization\Config" -Name "DODownloadMode" -Type DWord -Value 0
2025-09-16 19:04:11 +02:00
2026-01-08 21:04:36 +02:00
Write-Host "Disabled BITS Service"
Set-Service -Name BITS -StartupType Disabled
2025-09-16 19:04:11 +02:00
2026-01-08 21:04:36 +02:00
Write-Host "Disabled wuauserv Service"
Set-Service -Name wuauserv -StartupType Disabled
2026-01-08 09:01:34 -06:00
2026-01-08 21:04:36 +02:00
Write-Host "Disabled UsoSvc Service"
Set-Service -Name UsoSvc -StartupType Disabled
2026-01-08 09:01:34 -06:00
2026-01-08 21:04:36 +02:00
Write-Host "Disabled WaaSMedicSvc Service"
Set-Service -Name WaaSMedicSvc -StartupType Disabled
2025-09-16 19:04:11 +02:00
2026-01-08 21:04:36 +02:00
Remove-Item "C:\Windows\SoftwareDistribution\*" -Recurse -Force
Write-Host "Cleared SoftwareDistribution folder"
2025-09-16 19:04:11 +02:00
2025-09-05 09:27:26 -05:00
Write-Host "Disabling update related scheduled tasks..." -ForegroundColor Yellow
2025-09-16 19:04:11 +02:00
2026-01-08 21:04:36 +02:00
$Tasks =
'\Microsoft\Windows\InstallService\*',
'\Microsoft\Windows\UpdateOrchestrator\*',
'\Microsoft\Windows\UpdateAssistant\*',
'\Microsoft\Windows\WaaSMedic\*',
'\Microsoft\Windows\WindowsUpdate\*',
2025-09-05 09:27:26 -05:00
'\Microsoft\WindowsUpdate\*'
2026-01-08 21:04:36 +02:00
foreach ($Task in $Tasks) {
Get-ScheduledTask -TaskPath $Task | Disable-ScheduledTask -ErrorAction SilentlyContinue
2025-09-05 09:27:26 -05:00
}
Write-Host "=================================" -ForegroundColor Green
2026-01-08 21:04:36 +02:00
Write-Host "--- Updates Are Disabled ---" -ForegroundColor Green
Write-Host "=================================" -ForegroundColor Green
Write-Host "Note: You must restart your system in order for all changes to take effect." -ForegroundColor Yellow
}