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.