function Invoke-WPFUpdatesdefault { <# .SYNOPSIS Resets Windows Update settings to default #> Write-WinUtilLog -Component "Updates" -Message "Resetting Windows Update settings to default." Write-Host "Removing Windows Update settings managed by WinUtil..." -ForegroundColor Green Write-WinUtilLog -Component "Updates" -Message "Removing Windows Update registry values managed by WinUtil." $registryValues = @( @{ Path = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" Names = @("NoAutoUpdate", "AUOptions", "NoAutoRebootWithLoggedOnUsers", "AUPowerManagement") }, @{ Path = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" Names = @("ExcludeWUDriversInQualityUpdate", "DeferFeatureUpdates", "DeferFeatureUpdatesPeriodInDays", "DeferQualityUpdates", "DeferQualityUpdatesPeriodInDays") }, @{ Path = "HKLM:\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings" Names = @("BranchReadinessLevel", "DeferFeatureUpdatesPeriodInDays", "DeferQualityUpdatesPeriodInDays") }, @{ Path = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Device Metadata" Names = @("PreventDeviceMetadataFromNetwork") }, @{ Path = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\DriverSearching" Names = @("DontPromptForWindowsUpdate", "DontSearchWindowsUpdate", "DriverUpdateWizardWuSearchEnabled") }, @{ Path = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\DeliveryOptimization\Config" Names = @("DODownloadMode") } ) foreach ($registryEntry in $registryValues) { foreach ($valueName in $registryEntry.Names) { Remove-ItemProperty -Path $registryEntry.Path -Name $valueName -ErrorAction SilentlyContinue } } $explorerPolicyPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer" $settingsPageVisibility = (Get-ItemProperty -Path $explorerPolicyPath -Name "SettingsPageVisibility" -ErrorAction SilentlyContinue).SettingsPageVisibility if ($settingsPageVisibility -eq "hide:windowsupdate") { Write-Host "Removing WinUtil's legacy Windows Update page restriction..." Write-WinUtilLog -Component "Updates" -Message "Removing the legacy Windows Update settings page restriction." Remove-ItemProperty -Path $explorerPolicyPath -Name "SettingsPageVisibility" -ErrorAction SilentlyContinue } Write-Host "Reenabling Windows Update Services..." -ForegroundColor Green Write-WinUtilLog -Component "Updates" -Message "Restoring Windows Update service startup types." Write-Host "Restored BITS to Manual." Write-WinUtilLog -Component "Updates" -Message "Restoring BITS service to Manual." Set-Service -Name BITS -StartupType Manual Write-Host "Restored wuauserv to Manual." Write-WinUtilLog -Component "Updates" -Message "Restoring wuauserv service to Manual." Set-Service -Name wuauserv -StartupType Manual Write-Host "Restored UsoSvc to Automatic." Write-WinUtilLog -Component "Updates" -Message "Starting UsoSvc service and restoring startup type to Automatic." Set-Service -Name UsoSvc -StartupType Automatic Start-Service -Name UsoSvc Write-Host "Enabling update related scheduled tasks..." -ForegroundColor Green Write-WinUtilLog -Component "Updates" -Message "Enabling update related scheduled tasks." $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 -ErrorAction SilentlyContinue | Enable-ScheduledTask -ErrorAction SilentlyContinue } 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 Write-WinUtilLog -Component "Updates" -Message "Windows Update default workflow completed. Restart required." }