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: Most helpful
  1. Anonymous
    2025-01-24T17:41:38+00:00

    That's a lot of work to hide the window... and there is a much easier way. All you need to do is in your scheduled task, select "Run whether user is logged in or not", the select an account to run as and enter the password. SHAZAAM!!! All fixed.

    Here are the steps to put it all together. Incredibly easy. Promise!

    1. Open Notepad and enter these four lines of text...

    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

    1. Save the file as "Roll_Active_Hours.cmd". Don't use .BAT. It's ancient DOS. .CMD is slightly more modern, the NT era.
    2. Open Task Scheduler and create a new task. Select "Run with highest privileges" and "Run whether user is logged in or not" and "Configure For: Windows 10", since there is no Windows 11 option within Windows 11.
    3. In Triggers, create a single trigger. Choose "One time" and choose today's date and 12:00:00 PM. Then select Repeat task every: 12 hours. If there is no option in the drop down for 12 hours... just type it in. I check "Stop task if runs longer than: " and select 1 minute. If it takes longer than that, something is wrong. And of course, check the Enabled box to activate the trigger.
    4. In the Actions tab, select "Start a program" and then use the Browse... button to locate the "Roll_Active_Hours.cmd" script from steps 1 and 2.
    5. Everything on the Conditions tab should be unselected. In the Settings tab, check "Allow task to be run on demand" and "Run task as soon as possible after a scheduled start is missed" and "If the running ask does not end when requests, force it to stop".

    That's it. No windows flashing when the task runs. Only runs twice per day. You can run it manually if you like. And Windows 11 will never restart on its own.

    Was this answer helpful?

    5 people found this answer helpful.
    0 comments No comments
  2. Anonymous
    2024-06-01T10:15:00+00:00

    It was pointed out that the code I wrote doesn't always work in every locale depending on how your time is reported so I improved it. It'a still a command line cmd batch file:

    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 
    

    Again, save this code as a batch file and use Task Scheduler to run it every couple of hours to update your working hours.

    Image

    Was this answer helpful?

    5 people found this answer helpful.
    0 comments No comments
  3. Anonymous
    2024-06-27T18:31:55+00:00

    Do this:

    Open you notepad and past the code below:


    for /f "tokens=1 delims=:" %%a in ('time/t') do set currentHour=%%a

    if %currentHour% gtr 17 goto after6pm
    if %currentHour% gtr 5 goto after6am

    set /a startHour = %currentHour%+18
    set /a endHour = %currentHour%+6
    goto SetActiveHours

    :after6pm
    set /a startHour = %currentHour%-6
    set /a endHour = %currentHour%-18
    goto SetActiveHours

    :after6am
    set /a startHour = %currentHour%-6
    set /a endHour = %currentHour%+6

    :SetActiveHours

    set "activeHours=%startHour%,%endHour%"

    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


    save the notepad as noreboot.bat in some place, like c:/windows/

    open the task scheduler : press the windows key + R at the same time and in the prompt type:

    taskschd.msc

    this will open the task scheduler

    in the right panel click in create task

    name it as you will in the Gerneral tab

    In the Triggers tab create a new one with the contents below:

    Daily, repeat task every 1 hour for duration at: 1 day

    in Actions click in new with the action Start a program and in the browse locate your previous saved bat file, in this example, noreboot.bat.

    ok for all and there you have a task changing your work hours every hour.

    Was this answer helpful?

    4 people found this answer helpful.
    0 comments No comments
  4. Anonymous
    2024-05-30T15:06:58+00:00

    Thank you again and FYI: I had to change these lines to remove the double quotes (highlighted in green bold).

    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

    Was this answer helpful?

    4 people found this answer helpful.
    0 comments No comments
  5. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more