Files
winutil/functions/public/Invoke-WPFUpdatesdefault.ps1
Gabi 1eba305fab Update Invoke-WPFUpdatesdisable.ps1 to not require a restart (#4288)
* Update Invoke-WPFUpdatesdisable.ps1 to not require a restart

* Update Invoke-WPFUpdatesdisable.ps1

* Update Invoke-WPFUpdatesdefault.ps1

* Merge branch 'ChrisTitusTech:main' into patch-9
2026-04-02 15:07:34 -05:00

57 lines
2.3 KiB
PowerShell

function Invoke-WPFUpdatesdefault {
<#
.SYNOPSIS
Resets Windows Update settings to default
#>
$ErrorActionPreference = 'SilentlyContinue'
Write-Host "Removing Windows Update policy settings..." -ForegroundColor Green
Remove-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" -Recurse -Force
Remove-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\DeliveryOptimization" -Recurse -Force
Remove-Item -Path "HKLM:\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings" -Recurse -Force
Remove-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Device Metadata" -Recurse -Force
Remove-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\DriverSearching" -Recurse -Force
Remove-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -Recurse -Force
Write-Host "Reenabling Windows Update Services..." -ForegroundColor Green
Write-Host "Restored BITS to Manual"
Set-Service -Name BITS -StartupType Manual
Write-Host "Restored wuauserv to Manual"
Set-Service -Name wuauserv -StartupType Manual
Write-Host "Restored UsoSvc to Automatic"
Start-Service -Name UsoSvc
Set-Service -Name UsoSvc -StartupType Automatic
Write-Host "Restored WaaSMedicSvc to Manual"
Set-Service -Name WaaSMedicSvc -StartupType Manual
Write-Host "Enabling update related scheduled tasks..." -ForegroundColor Green
$Tasks =
'\Microsoft\Windows\InstallService\*',
'\Microsoft\Windows\UpdateOrchestrator\*',
'\Microsoft\Windows\UpdateAssistant\*',
'\Microsoft\Windows\WaaSMedic\*',
'\Microsoft\Windows\WindowsUpdate\*',
'\Microsoft\WindowsUpdate\*'
foreach ($Task in $Tasks) {
Get-ScheduledTask -TaskPath $Task | Enable-ScheduledTask -ErrorAction SilentlyContinue
}
Write-Host "Windows Local Policies Reset to Default"
secedit /configure /cfg "$Env:SystemRoot\inf\defltbase.inf" /db defltbase.sdb
Write-Host "===================================================" -ForegroundColor Green
Write-Host "--- Windows Update Settings Reset to Default ---" -ForegroundColor Green
Write-Host "===================================================" -ForegroundColor Green
Write-Host "Note: You must restart your system in order for all changes to take effect." -ForegroundColor Yellow
}