Windows 11 seems to have disabled all ways to get around Auto Update Restarts. Is there a workaround?
May 27
I run Matlab simulations that sometimes take weeks to finish and when Windows restarts I lose all my work so I really need a way to stop auto restarts.
Windows 11 seems to have disabled all ways to get around Auto Update Restarts. Is there a still a workaround?
It used to be possible to set NoAutoRebootWithLoggedOnUsers in:
Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU
if you also set AUOptions to 4 in the same location but this does not work for me now.
1 answer
Accepted answer · original discussion
May 28
Windows will not reboot during working hours. My solution is to run a scheduled task that changes the working hours in the registry, say every hour or two, so that it is always a working hour. I coded up this 4 line cmd command batch file program:
for /f %%i in ('powershell "((get-date).Hour+18) %% 24"') do set startHour=%%i
for /f %%i in ('powershell "((get-date).Hour+12) %% 24"') do set endHour=%%i
reg add HKLM\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings /v ActiveHoursStart /t REG_DWORD /d %startHour% /f
reg add HKLM\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings /v ActiveHoursEnd /t REG_DWORD /d %endHour% /f
I then used Windows Task Scheduler to make this .bat script run every hour for 1 day and repeat daily. (Use Triggers, Begin the task:on a schedule. Set Daily, Click tickmark beside Repeat task every [1 hour])
To stop pop-ups of the command windows, make task scheduler start the program/script "cmd.exe"
and put as its arguments:
/c start /min C:\work\disableautoupdate.bat ^& exit
(Substitute your own filename above for C:\work\disableautoupdate.bat. NB don't put quotes around the filename)
This will minimise the window your script runs in.
Tested: It works! I installed an update requiring a restart on 31-May. I am informed that this restart will happen outside of working hours. As of 20-June, 22 days later, no restart had taken place.
I figured out how to incorporate @Jonathan's feedback. It is easier to do modulo maths (and to get the hour independent of locale/region/format preferences) with powershell commands. It's still a cmd batch file, but it calls powershell. Reduces to 4 lines and should work everywhere.
3 question comments
Use comments to ask for clarification. Post a solution as an answer.
May 27
May 27