mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2026-08-10 01:51:18 +10:00
* Harden Pester CI and discard runspace return values * Add prioritized test backlog * Add WinUtil action logging * Add config integrity tests * Add XAML control wiring tests * Add registry and service helper tests * Add package manager tests * Add runspace behavior tests * Add tweak orchestration tests * Add install workflow tests * Add update profile tests * Add AppX removal tests * Log package installer output * Add UI state helper tests * Pin Pester test runner version * Expand Win11 Creator tests * Add preferences and theme tests * Add search filter tests * Add compile contract tests * Use single WinUtil session log * Remove installer output logging helper * Handle locked WinUtil transcript log * Avoid appending to active transcript log * Log install uninstall package identities
67 lines
3.2 KiB
PowerShell
67 lines
3.2 KiB
PowerShell
function Invoke-WPFUpdatesdisable {
|
|
<#
|
|
|
|
.SYNOPSIS
|
|
Disables Windows Update
|
|
|
|
.NOTES
|
|
Disabling Windows Update is not recommended. This is only for advanced users who know what they are doing.
|
|
|
|
#>
|
|
$ErrorActionPreference = 'SilentlyContinue'
|
|
Write-WinUtilLog -Component "Updates" -Message "Disabling Windows Update settings."
|
|
|
|
Write-Host "Configuring registry settings..." -ForegroundColor Yellow
|
|
Write-WinUtilLog -Component "Updates" -Message "Configuring Windows Update registry policy values for disable mode."
|
|
New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" -Force
|
|
|
|
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
|
|
|
|
New-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\DeliveryOptimization\Config" -Force
|
|
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\DeliveryOptimization\Config" -Name "DODownloadMode" -Type DWord -Value 0
|
|
|
|
Write-Host "Hiding Windows Updates from settings..."
|
|
Write-WinUtilLog -Component "Updates" -Message "Hiding Windows Update settings page."
|
|
Set-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer -Name SettingsPageVisibility -Value hide:windowsupdate
|
|
|
|
Write-Host "Disabled BITS Service."
|
|
Write-WinUtilLog -Component "Updates" -Message "Disabling BITS service."
|
|
Set-Service -Name BITS -StartupType Disabled
|
|
|
|
Write-Host "Disabled wuauserv Service."
|
|
Write-WinUtilLog -Component "Updates" -Message "Disabling wuauserv service."
|
|
Set-Service -Name wuauserv -StartupType Disabled
|
|
|
|
Write-Host "Disabled UsoSvc Service."
|
|
Write-WinUtilLog -Component "Updates" -Message "Stopping and disabling UsoSvc service."
|
|
Stop-Service -Name UsoSvc -Force
|
|
Set-Service -Name UsoSvc -StartupType Disabled
|
|
|
|
Remove-Item "C:\Windows\SoftwareDistribution\*" -Recurse -Force
|
|
Write-Host "Cleared SoftwareDistribution folder."
|
|
Write-WinUtilLog -Component "Updates" -Message "Cleared SoftwareDistribution folder."
|
|
|
|
Write-Host "Disabling update related scheduled tasks..." -ForegroundColor Yellow
|
|
Write-WinUtilLog -Component "Updates" -Message "Disabling 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 | Disable-ScheduledTask -ErrorAction SilentlyContinue
|
|
}
|
|
|
|
Write-Host "=================================" -ForegroundColor Green
|
|
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
|
|
Write-WinUtilLog -Component "Updates" -Message "Windows Update disable workflow completed. Restart required."
|
|
}
|