ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

Special User Sections > N.A.N.Y. 2017

NANY 2017: MMAHW! (Make My Active Hours Work!) - Cancelled

(1/3) > >>

wraith808:
I just had to post this when I had the idea after Windows 10 asked me to reboot my computer again, and I dreaded when it automagically reboots.

Problem: Windows Active hours are only 12 hours max.  For contractors like me, this sucks.  My active hours for work are 8AM to 12AM.  Many people have said that it checks if it's outside your hours to see if there's activity, so you don't need it.  Bull!  I went upstairs outside of my active hours to make some coffee.  And came back to find my computer unusable for over an hour while it did it's thing.  Unacceptable!  I could turn updates off- I found something to do that.  But not to extend my active hours.

Solution:  I found the registry key, tested it, and it does actually set the hours in the app.  Not sure if it works beyond 12 hours though... but I came up with my idea for the NANY entry... an interface that allows you to set your active hours to however long you want to set it.  Then, every hour on the half hour to make sure I don't miss it, it updates your Active Hours start to 1 hour after your span, and updates the end to 1 hour after your revolving end.  Basically using the algorithm: -6 hours < current time < +6 hours.

I can be the change I want to see!  Hopefully, it won't trigger the Microsoft update to fix the hole in their scheme.

If someone doesn't want to wait for me to do it, the keys are as follows:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings\ActiveHoursStart
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings\ActiveHoursEnd

Though, given that it's trying to restart my computer NOW, it will probably be up in some form sooner than later.

Deozaan:
This sounds mighty useful! I'm looking forward to your entry. :)

antekgla:
Not a App for NANY but a solution for you...

The batch script code:


--- Code: Text ---:: 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 [email protected] offset /a AHS=%time:~0,2%-1IF %AHS% LSS 0 set /a AHS=%AHS%+24set /a AHE=%time:~0,2%+9IF %AHE% GTR 24 set /a AHE=%AHE%-24reg.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%
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: Text ---<?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>

Source: Windows 10 Forums

wraith808:
I can be the change I want to see!  Hopefully, it won't trigger the Microsoft update to fix the hole in their scheme.
-wraith808 (October 28, 2016, 04:24 PM)
--- End quote ---

Apparently, my fears came true.  All of a sudden, though the registry keys are set correctly, it stopped updating in Windows.  I thought it might be the tweaks I did to get it to not restart at all, but I tried on a machine that I'd not put those tweaks on.  So, as a result, even though the NANY is done, I won't be releasing it.

A little more information:

Formerly, when I ran the application and changed the times, it would show up in the registry and in the interface.  Now, it only shows up in the registry, and the interface in the active hours is set back to default, i.e. 8AM - 5PM.  The only time it used to do this was if I tried to set it for longer than 12 hours.  If I set it through the regular interface, it does indeed use those registry entries.  But with the interface acting strange, I don't feel comfortable releasing it for anyone's use.

wraith808:
On another point, if someone wants to help and let me know if the behavior on their machine is the same behavior I'm seeing on my machines, I'd appreciate it :)

Navigation

[0] Message Index

[#] Next page

Go to full version