Created
April 25, 2025 21:58
-
-
Save flipeador/ff80f0bcd4971dffdc26c44815509236 to your computer and use it in GitHub Desktop.
Automated adjustment of Windows Update active hours with AutoHotkey.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Requires AutoHotkey v2 | |
key := "HKLM\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings" | |
RegWrite(Mod(A_Hour + 23, 24), 'REG_DWORD', key, 'ActiveHoursStart') | |
RegWrite(Mod(A_Hour + 11, 24), 'REG_DWORD', key, 'ActiveHoursEnd') | |
RegWrite(2, 'REG_DWORD', key, 'SmartActiveHoursState') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
Programmatically modify the Windows registry to redefine the system's active hours for Windows Update.
ActiveHoursStart
to one hour before the current time andActiveHoursEnd
to 11 hours after that, effectively creating a 12-hour activity window.SmartActiveHoursState
to 2, thereby disabling Windows' automatic adjustment of active hours based on usage patterns.This preventive configuration, executed in 8-hour intervals, mitigates the risk of involuntary system reboots following update installations that require a restart, thereby preserving workflow continuity and user control.
Instructions
Install AutoHotkey v2 in
%ProgramFiles%\AutoHotkey
.Place
move-active-hours.ahk
in%ProgramFiles%\AutoHotkey\Scripts
.Open the Windows Terminal as Administrator and run the following PowerShell script: