Windows 10 Active Hours

Do you have questions about writing plugins or scripts in Python? Meet the coders here.
Post Reply
Experienced User
Posts: 203
Joined: Thu Feb 10, 2011 2:16 am

Windows 10 Active Hours

Post by Dragon470 » Sat Mar 25, 2017 1:13 am

So for the second time I have lost valuable data to my Windows 10 computer deciding to update and restart on the concept of "Active Hours". If you don't know what I am talking about, just look it up. This is my solution to the computer randomly restarting on me.

Just change the registry keys for the start and end times of the active hours.

I use the ScheduleGhost plugin to go off every 6 hours.

It calls this script:

Code: Select all

import datetime

#Changes start time
start = - datetime.timedelta(hours=1)
T = str(hex(start.hour))
Temp = 'reg add "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\WindowsUpdate\\UX\\Settings" /f /v "ActiveHoursStart" /t REG_DWORD /d ' + T
eg.plugins.System.Command(Temp, True, False, u'', True, False, False, True, True)

#Changes end time
end = + datetime.timedelta(hours=11)
T = str(hex(end.hour))
Temp = 'reg add "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\WindowsUpdate\\UX\\Settings" /f /v "ActiveHoursEnd" /t REG_DWORD /d ' + T
eg.plugins.System.Command(Temp, True, False, u'', True, False, False, True, True)
This just changes the keys to 1 hours earlier and 11 hours ahead. This is because It only allows for a 12 hour range.

I find it sad I have to resort to this just to prevent data loss if I walk away from my computer for too long.

User avatar
Site Admin
Posts: 4506
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Windows 10 Active Hours

Post by kgschlosser » Sat Mar 25, 2017 7:25 am

welcome to the world of Microsoft.. and why i am still using Windows 7
If you like the work I have been doing then feel free to Image

Posts: 33
Joined: Sat Mar 27, 2010 4:08 pm

Re: Windows 10 Active Hours

Post by copota » Fri Jun 16, 2017 7:43 am

This is a clever method to avoid M$ from forcing their spyware updates. So you're basically automating a script to run, which continually changes the active hours every 6 hours, to avoid it from engaging a restart?

I see you use ScheduleGhost to fire the script. Why not use Microsofts own Task Scheduler? I love EventGhost, but it can sometimes crash, so maybe using Microsofts Task Scheduler might be a bit more reliable.

What I've been doing to avoid an automatic restart, which seems to work, is the following....

1. Create a new registry 32-bit DWORD value called IsActiveHoursEnabled and set its value data to 0. The registry entry is created at the following registry location:


2. Edit a Local Group policy for Automatic Updates by running gpedit.msc to open Local Group Policy, then navigate to Computer Configuration\Administrative Templates\Windows Components\Windows Update. Locate the “Configure Automatic Updates” setting in the right pane and double-click it. Set it to “Enabled,” and then select either “Auto download and notify for install” or “Notify for download and notify for install.” Save the change.

So far, I haven't had Win10 automatically reboot on me. If Windows does to start to ignore these settings, I'll be using your method. Thanks for the tip.

Post Reply