Skip to content

Instantly share code, notes, and snippets.

@oledid
Last active August 28, 2024 09:05
Show Gist options
  • Save oledid/a593683e930d8ba6c59b6a6937532b2f to your computer and use it in GitHub Desktop.
Save oledid/a593683e930d8ba6c59b6a6937532b2f to your computer and use it in GitHub Desktop.
Disable windows update reboot.cmd
rem Source: https://answers.microsoft.com/en-us/windows/forum/all/how-to-disable-windows-11-automatic-reboots/d7766f02-59a1-48f4-af6e-761345704ead?page=1
rem Author: Michael 'The Curate'
rem Howto:
rem This script works by adjusting your 'Active hours'. You should schedule it to run every hour with the task scheduler.
rem To not get an "annoying popup" when it gets run you need to be running it "whether user is logged in or not"
rem You probably also need administrative privileges to edit the registry
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment