Welcome to the Power Users community on Codidact!
Power Users is a Q&A site for questions about the usage of computer software and hardware. We are still a small site and would like to grow, so please consider joining our community. We are looking forward to your questions and answers; they are the building blocks of a repository of knowledge we are building together.
How to stop all automatic Windows Update restarts on a Windows 10 Pro machine?
I have Octoprint on a Windows 10 computer to print to an Ender 5, it's fairly often that prints will go overnight and around 15-16 hours.
If Windows Updates plus a restart were to happen during that time it will be a major problem.
How can I turn off automatic Windows Updates that will restart the computer without user input?
3 answers
Windows 10 allows you to set "office hours" during which it won't automatically reboot. Unfortunately, it doesn't allow you to set the entire day as office hours. So the trick is to change your office hours frequently in such a way that it's always office hours.
https://github.com/Maimer/update-active-hours contains a simple implementation of this trick; I have an uncommitted fork which offsets 1 hour back in the past - I can't remember, but I may have found that this was necessary.
update_active_hours.ps1
:
$registryPath = "HKLM:\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings"
if (Test-Path -Path "${registryPath}") {
$currentHour = (Get-Date).hour
$activeHoursStart = $currentHour - 1
if ($activeHoursStart -lt 0) {
$activeHoursStart = $activeHoursStart + 24
}
$activeHoursEnd = $activeHoursStart + 12
if ($activeHoursEnd -gt 23) {
$activeHoursEnd = $activeHoursEnd - 24
}
Set-ItemProperty -Path "${registryPath}" -Name "ActiveHoursStart" -Value "${activeHoursStart}"
Set-ItemProperty -Path "${registryPath}" -Name "ActiveHoursEnd" -Value "${activeHoursEnd}"
}
This is run by a scheduled task which executes every 6 hours with action
Powershell.exe -ExecutionPolicy Unrestricted -File path\to\update_active_hours.ps1
0 comment threads
You can pause updates for a while, which should be good enough for your use case. The following looks like it'll work on at least Windows 10 21H1 Pro.
Go into Settings -> Windows Update, and select Pause updates for [X] days.
When the task is complete, it's probably a good idea to manually go back into Windows Update settings and select to resume updates.
Alternatively, also under Settings -> Windows Update, you can go into Advanced options to manually select the pause duration.
0 comment threads
Others have posted some workarounds that directly answer your question, but my own answer to the implied deeper question ("how do I prevent my [currently Windows 10] machine from rebooting during a long OctoPrint job") is simpler: Use a better, less controlling OS. OctoPrint is available for Linux, and is apparently (per Wikipedia) commonly and successfully run on Raspberry Pi (with a special-purpose distribution called OctoPi even providing it pre-installed). So do any of the following:
-
Back up your data and install your choice of Linux distribution in place of Windows (I use a custom Debian spin myself, but something like BunsenLabs or CrunchBang++ is probably a user-friendlier starting point, if you're not familiar with Linux already).
-
Back up your data, partition your hard drive, and install Linux alongside Windows, in a dual-boot setup, and try to gradually learn how to do more and more things in Linux.
-
Install Linux alongside Windows in a dual-boot setup, use Linux for long print jobs and other uninterruptible tasks, and keep using Windows for everything else (requires that you never need to do something else while in the middle of a print job).
-
Get a Raspberry Pi and use that for long print jobs and other uninterruptible tasks, and keep using Windows 10 on your existing machine for everything else.
1 comment thread