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.
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)
This will minimise the window your script runs in.
[](https://i.sstatic.net/cCPkMagY.png)
**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.