JustPaste.it
The batch script code:

[CODE]
:: Setting Active Hours Start (AHS) and End (AHE) times to 1 hour before the current time through 9 hours after the current time, i.e., a total of 10 hours window
@ECHO off
set /a AHS=%time:~0,2%-1
IF %AHS% LSS 0 set /a AHS=%AHS%+24
set /a AHE=%time:~0,2%+9
IF %AHE% GTR 24 set /a AHE=%AHE%-24
reg.exe ADD HKLM\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings /v ActiveHoursStart /t REG_DWORD /f /d %AHS%
reg.exe ADD HKLM\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings /v ActiveHoursEnd /t REG_DWORD /f /d %AHE%
[/CODE]

Save it as .bat, place it in not-a-temporary place, and create a scheduled task in the Task Scheduler (Windows+R > taskschd.msc > Enter) which'll run it, say, every 8 hours (one hour before the changed active hours end time). Here is one way to create it which can ensure regular runs:
1. Create new task
2. General tab: set user account to SYSTEM OR User with highest privileges and check "Run whether user is logged on or not"
3. Triggers tab: 2 options:
A. 2 triggers - a. "On a schedule" + One time (choose any time for the 1st run) + Repeat task every 8 hours for a duration of "Indefinitely" b. "At log on of any user" (this ensures not missing the active hours reset when you reboot)
B. 1 trigger - "At log on of any user" and set to repeat every 8 hours indefinitely
4. Actions tab: Start program: Set the path of the file (use quotes if the path has spaces)
5. Conditions tab: Uncheck "... only on AC power"
6. Settings tab: Check "Run task as soon as possible after a scheduled start is missed" (further ensures that you don't miss active hours reset if the task fails to run as per schedule)

^If you like you may set the task to run every hour indefinitely instead of eight, but I'd say it'll be a bit of an overkill.

I haven't had any updates since I've put my task up, so can't confirm if its working. However, if cbarn's script works, this should too.

PS: If you just want to import the task that I've made, here is my task's xml code (save it as an .xml and import in the Task Scheduler):

[CODE]
<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.4" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
<RegistrationInfo>
<Date>2016-11-02T22:43:57.9678364</Date>
<Author>RS</Author>
<URI>\WU change active hours</URI>
</RegistrationInfo>
<Triggers>
<TimeTrigger>
<Repetition>
<Interval>PT8H</Interval>
<StopAtDurationEnd>false</StopAtDurationEnd>
</Repetition>
<StartBoundary>2016-11-01T23:00:00</StartBoundary>
<ExecutionTimeLimit>P3D</ExecutionTimeLimit>
<Enabled>true</Enabled>
</TimeTrigger>
<LogonTrigger>
<ExecutionTimeLimit>P3D</ExecutionTimeLimit>
<Enabled>true</Enabled>
</LogonTrigger>
</Triggers>
<Principals>
<Principal id="Author">
<UserId>S-1-5-18</UserId>
<RunLevel>HighestAvailable</RunLevel>
</Principal>
</Principals>
<Settings>
<MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
<DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries>
<StopIfGoingOnBatteries>true</StopIfGoingOnBatteries>
<AllowHardTerminate>true</AllowHardTerminate>
<StartWhenAvailable>true</StartWhenAvailable>
<RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
<IdleSettings>
<StopOnIdleEnd>true</StopOnIdleEnd>
<RestartOnIdle>false</RestartOnIdle>
</IdleSettings>
<AllowStartOnDemand>true</AllowStartOnDemand>
<Enabled>false</Enabled>
<Hidden>false</Hidden>
<RunOnlyIfIdle>false</RunOnlyIfIdle>
<DisallowStartOnRemoteAppSession>false</DisallowStartOnRemoteAppSession>
<UseUnifiedSchedulingEngine>true</UseUnifiedSchedulingEngine>
<WakeToRun>false</WakeToRun>
<ExecutionTimeLimit>PT72H</ExecutionTimeLimit>
<Priority>7</Priority>
</Settings>
<Actions Context="Author">
<Exec>
<Command>"F:\WU\wu_active_hrs.bat"</Command>
</Exec>
</Actions>
</Task>
[/CODE]