The +18 in the first line comes to -6 when you do the modulo 24 hour logic. That is just to make sure that the start is well and truly in the past just in case there is ambiguity about which minute of the hour it is and when the hour starts.
How to disable Windows 11 automatic reboots?
Hi,
I have browsed this forum but found so far no real solution:
It has happened to my now several times that I was running tasks over extended periods of time only to come back to my PC the next morning to find Windows 11 had done an automatic reboot! So not only the tasks weren't finished, worse, lots of preparatory work was lost!
I don't want Windows to ever automatically reboot after an update. Never. Ever. Period. I want to be informed about updates, that's fine, and I keep Windows 11 up to date, but under no circumstances ever is it acceptable that Windows just shovels an update on my PC and disrupts overnight tasks and REBOOTS(!) my PC all by itself.
So it would be very helpful if somebody could tell me how to disable these automatic update reboots once and for all. I don't want to "pause" Updates (I absolutely want updates, I just want to control myself when the updates are done) and resetting "work hours" is of no use unless I can set it to 24 hours.
Best regards
Nick
Windows for home | Windows 11 | Windows update
Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.
84 answers
Sort by: Most helpful
-
Anonymous
2024-12-19T17:35:01+00:00 -
Anonymous
2024-12-19T16:35:49+00:00 This is brilliant... rolling the active hours... but I don't quite get your logic. The active hours are the hours in which Windows CANNOT reboot. So you want to set the START hour to the current hour. And set the END hour 18 hours in the future. This means it can't reboot during the current 18 hour window.
for /f %%i in ('powershell "((get-date).Hour) %% 24"') do set startHour=%%i
for /f %%i in ('powershell "((get-date).Hour+18) %% 24"') do set endHour=%%i
DON'T add hours for the first line. Add 18 to the second line (endHour). Then run the task every 12 hours. No need to run every hour.
For less savvy users... when scheduling in Task Scheduler... schedule the task "On a schedule"... "One Time" to run at NOON... and then "Repeat task every" 12 Hours... Indefinitely. In the task Settings tab, "Run task as soon as possible after a scheduled start is missed". On the General tab, have it run if logged on or not and store an admin password, Run with highest privileges, and mark as Hidden.
-
Anonymous
2024-12-15T21:43:42+00:00 Note that this script depends on you having your clock settings enabled for 24 hour clock format (i.e. 2pm is 1400). I know this is typically the default for Europe and non-US, but the default recommended settings in the US will be the 12hr format. The script will make incorrect assumptions/calculations with 12 hr format (e.g. when running batch file at 4pm, it set active time 2200 start and 1000 end time, which would make Microsoft think it 6 whole hours where it could initiate a restart, since I ran the batch file at 4:12pm !)
Simple fix - just change your clock to 24hr format and works fine.
-
Anonymous
2024-11-14T12:25:16+00:00 I add the key and going to disable the batch disablereboot.bat.
The batch was working with some glitches, but, no more reboots,
Will try this solution and comment the results,
-
Anonymous
2024-11-13T15:00:40+00:00 I sure hope this works.