I want to use a powershell script to turn off windows update service & auto updates windows 10 using powershell. I\'ve searched around but the commands didn\'t turn eit
EDIT 2020-07-30:
The former solution, which is bellow, works only partially: it does not disable the WindowsUpdate/sihpostreboot service, because Microsoft is fighting against guides like this.
WHAT WORKS FULLY: (how to disable the rest)
THE ORIGINAL ANSWER:
This script is based on Kemal's answer.
The improvement is that it disables also tasks in WindowsUpdate and UpdateOrchestrator folders that cannot be disabled manually in Task Scheduler. Furthermore, it disables the Windows Update service.
Recommended execution:
Clear-Host
$WindowsUpdatePath = "HKLM:SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\"
$AutoUpdatePath = "HKLM:SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU"
If(Test-Path -Path $WindowsUpdatePath) {
Remove-Item -Path $WindowsUpdatePath -Recurse
}
New-Item $WindowsUpdatePath -Force
New-Item $AutoUpdatePath -Force
Set-ItemProperty -Path $AutoUpdatePath -Name NoAutoUpdate -Value 1
Get-ScheduledTask -TaskPath "\Microsoft\Windows\WindowsUpdate\" | Disable-ScheduledTask
takeown /F C:\Windows\System32\Tasks\Microsoft\Windows\UpdateOrchestrator /A /R
icacls C:\Windows\System32\Tasks\Microsoft\Windows\UpdateOrchestrator /grant Administrators:F /T
Get-ScheduledTask -TaskPath "\Microsoft\Windows\UpdateOrchestrator\" | Disable-ScheduledTask
Stop-Service wuauserv
Set-Service wuauserv -StartupType Disabled
# We disable WindowsUpdate folder again, because wuauserv service could have enabled it meanwhile
Get-ScheduledTask -TaskPath "\Microsoft\Windows\WindowsUpdate\" | Disable-ScheduledTask
Write-Output "All Windows Updates were disabled"
Note: the script may display execution errors if WindowsUpdate folder or UpdateOrchestrator folder does not exist.
Note 2: you may need to run the script again after some Microsoft installer runs (like .Net Framework installer, Visual Studio installer, ...), because they enable updates again.