How to disable Windows 11 automatic reboots?

Anonymous
2024-02-18T11:19:20+00:00

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.

0 comments No comments

84 answers

Sort by: Oldest
  1. 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.

    Was this answer helpful?

    0 comments No comments
  2. 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.

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2024-12-19T17:35:01+00:00

    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.

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2024-12-20T17:00:12+00:00

    for /f "tokens=*" %%a in ('powershell "(Get-Date).Hour"') do set startHour=%%a

    set /a "endHour=(%starthour%+18)%%24"
    
    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
    

    There should be no modulus in the first line. Powershell ALWAYS returns a 24 hour integer for the command (Get-Date).Hour. If it's 5:00 in morning or 5:59, it returns 5. If it's 3:29 PM, it returns 15.

    The second line adds 18 hours and uses modulus to ensure the time wraps at midnight, so ( 15 [3PM] + 18 ) % 24 = 33 % 24 = 9 [AM].

    Run it at 12 PM and 12 AM... or 9AM and 9PM... you'll always have 6 hour overlap. It's infallible.

    Was this answer helpful?

    0 comments No comments
  5. Anonymous
    2025-01-13T21:17:00+00:00

    I'm just a user who doesn't know much but for me all I did was go to settings, search for update, clicked "advance options" and toggled the "notify me when a restart is required to finish updating" to "On". Now it has to asks me if I want to restart.

    Was this answer helpful?

    0 comments No comments