topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Thursday March 28, 2024, 7:59 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: NANY 2017: MMAHW! (Make My Active Hours Work!) - Cancelled  (Read 10442 times)

wraith808

  • Supporting Member
  • Joined in 2006
  • **
  • default avatar
  • Posts: 11,186
    • View Profile
    • Donate to Member
NANY 2017: MMAHW! (Make My Active Hours Work!) - Cancelled
« on: October 28, 2016, 04:24 PM »
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.
« Last Edit: December 31, 2016, 10:18 PM by wraith808 »

Deozaan

  • Charter Member
  • Joined in 2006
  • ***
  • Points: 1
  • Posts: 9,747
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: NANY 2017: MMAHW! (Make My Active Hours Work!)
« Reply #1 on: October 28, 2016, 08:22 PM »
This sounds mighty useful! I'm looking forward to your entry. :)

antekgla

  • Participant
  • Joined in 2011
  • *
  • Posts: 75
    • View Profile
    • SRTFilter
    • Donate to Member
Re: NANY 2017: MMAHW! (Make My Active Hours Work!)
« Reply #2 on: December 09, 2016, 01:23 PM »
Not a App for NANY but a solution for you...

The batch script code:

Code: Text [Select]
  1. :: 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
  2. @ECHO off
  3. set /a AHS=%time:~0,2%-1
  4. IF %AHS% LSS 0 set /a AHS=%AHS%+24
  5. set /a AHE=%time:~0,2%+9
  6. IF %AHE% GTR 24 set /a AHE=%AHE%-24
  7. reg.exe ADD HKLM\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings /v ActiveHoursStart /t REG_DWORD /f /d %AHS%
  8. 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 [Select]
  1. <?xml version="1.0" encoding="UTF-16"?>
  2. <Task version="1.4" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
  3. <RegistrationInfo>
  4. <Date>2016-11-02T22:43:57.9678364</Date>
  5. <Author>RS</Author>
  6. <URI>\WU change active hours</URI>
  7. </RegistrationInfo>
  8. <Triggers>
  9. <TimeTrigger>
  10. <Repetition>
  11. <Interval>PT8H</Interval>
  12. <StopAtDurationEnd>false</StopAtDurationEnd>
  13. </Repetition>
  14. <StartBoundary>2016-11-01T23:00:00</StartBoundary>
  15. <ExecutionTimeLimit>P3D</ExecutionTimeLimit>
  16. <Enabled>true</Enabled>
  17. </TimeTrigger>
  18. <LogonTrigger>
  19. <ExecutionTimeLimit>P3D</ExecutionTimeLimit>
  20. <Enabled>true</Enabled>
  21. </LogonTrigger>
  22. </Triggers>
  23. <Principals>
  24. <Principal id="Author">
  25. <UserId>S-1-5-18</UserId>
  26. <RunLevel>HighestAvailable</RunLevel>
  27. </Principal>
  28. </Principals>
  29. <Settings>
  30. <MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
  31. <DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries>
  32. <StopIfGoingOnBatteries>true</StopIfGoingOnBatteries>
  33. <AllowHardTerminate>true</AllowHardTerminate>
  34. <StartWhenAvailable>true</StartWhenAvailable>
  35. <RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
  36. <IdleSettings>
  37. <StopOnIdleEnd>true</StopOnIdleEnd>
  38. <RestartOnIdle>false</RestartOnIdle>
  39. </IdleSettings>
  40. <AllowStartOnDemand>true</AllowStartOnDemand>
  41. <Enabled>false</Enabled>
  42. <Hidden>false</Hidden>
  43. <RunOnlyIfIdle>false</RunOnlyIfIdle>
  44. <DisallowStartOnRemoteAppSession>false</DisallowStartOnRemoteAppSession>
  45. <UseUnifiedSchedulingEngine>true</UseUnifiedSchedulingEngine>
  46. <WakeToRun>false</WakeToRun>
  47. <ExecutionTimeLimit>PT72H</ExecutionTimeLimit>
  48. <Priority>7</Priority>
  49. </Settings>
  50. <Actions Context="Author">
  51. <Exec>
  52. <Command>"F:\WU\wu_active_hrs.bat"</Command>
  53. </Exec>
  54. </Actions>
  55. </Task>


Source: Windows 10 Forums
SRTFilter Automatic Subtitle Editor & Renamer
Dualcopy If you use Teracopy or Fastcopy this can be interesting   - My N.A.N.Y 2018 Entry

wraith808

  • Supporting Member
  • Joined in 2006
  • **
  • default avatar
  • Posts: 11,186
    • View Profile
    • Donate to Member
Re: NANY 2017: MMAHW! (Make My Active Hours Work!)
« Reply #3 on: December 31, 2016, 10:17 PM »
I can be the change I want to see!  Hopefully, it won't trigger the Microsoft update to fix the hole in their scheme.

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.
« Last Edit: December 31, 2016, 10:30 PM by wraith808 »

wraith808

  • Supporting Member
  • Joined in 2006
  • **
  • default avatar
  • Posts: 11,186
    • View Profile
    • Donate to Member
Re: NANY 2017: MMAHW! (Make My Active Hours Work!) - Cancelled
« Reply #4 on: January 01, 2017, 02:06 PM »
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 :)

app103

  • That scary taskbar girl
  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 5,884
    • View Profile
    • Donate to Member
Re: NANY 2017: MMAHW! (Make My Active Hours Work!) - Cancelled
« Reply #5 on: January 05, 2017, 03:59 AM »
To the best of my knowledge, answer #5 here, works well, and involves setting up a scheduled task that runs every 10 minutes and disables the scheduled task that is the automatic reboot task, after an update. I made only one change to the task, and that is for when that task starts running (at startup instead of some specific time of day set by original author).

No additional scripts, .bat files, or programs are needed, other than just importing this scheduled task, and manually running it the first time (or rebooting).

Code: Text [Select]
  1. <?xml version="1.0" encoding="UTF-16"?>
  2. <Task version="1.4" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
  3.   <RegistrationInfo>
  4.     <Date>2017-01-05T04:05:51.0187432</Date>
  5.     <Author>http://superuser.com/users/1909/kpozin</Author>
  6.     <URI>\NoReboot</URI>
  7.   </RegistrationInfo>
  8.   <Triggers>
  9.     <BootTrigger>
  10.       <Repetition>
  11.         <Interval>PT10M</Interval>
  12.         <StopAtDurationEnd>false</StopAtDurationEnd>
  13.       </Repetition>
  14.       <Enabled>true</Enabled>
  15.     </BootTrigger>
  16.   </Triggers>
  17.   <Principals>
  18.     <Principal id="Author">
  19.       <UserId>S-1-5-18</UserId>
  20.       <RunLevel>HighestAvailable</RunLevel>
  21.     </Principal>
  22.   </Principals>
  23.   <Settings>
  24.     <MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
  25.     <DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries>
  26.     <StopIfGoingOnBatteries>true</StopIfGoingOnBatteries>
  27.     <AllowHardTerminate>true</AllowHardTerminate>
  28.     <StartWhenAvailable>true</StartWhenAvailable>
  29.     <RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
  30.     <IdleSettings>
  31.       <StopOnIdleEnd>true</StopOnIdleEnd>
  32.       <RestartOnIdle>false</RestartOnIdle>
  33.     </IdleSettings>
  34.     <AllowStartOnDemand>true</AllowStartOnDemand>
  35.     <Enabled>true</Enabled>
  36.     <Hidden>false</Hidden>
  37.     <RunOnlyIfIdle>false</RunOnlyIfIdle>
  38.     <DisallowStartOnRemoteAppSession>false</DisallowStartOnRemoteAppSession>
  39.     <UseUnifiedSchedulingEngine>true</UseUnifiedSchedulingEngine>
  40.     <WakeToRun>false</WakeToRun>
  41.     <ExecutionTimeLimit>PT1H</ExecutionTimeLimit>
  42.     <Priority>7</Priority>
  43.   </Settings>
  44.   <Actions Context="Author">
  45.     <Exec>
  46.       <Command>schtasks</Command>
  47.       <Arguments>/change /tn \Microsoft\Windows\UpdateOrchestrator\Reboot /DISABLE</Arguments>
  48.     </Exec>
  49.   </Actions>
  50. </Task>

wraith808

  • Supporting Member
  • Joined in 2006
  • **
  • default avatar
  • Posts: 11,186
    • View Profile
    • Donate to Member
Re: NANY 2017: MMAHW! (Make My Active Hours Work!) - Cancelled
« Reply #6 on: January 05, 2017, 06:32 AM »
That particular script solves a different problem, i.e. disabling reboots.  The purpose of this program was to allow you to set your active hours to longer than 12 hours,

app103

  • That scary taskbar girl
  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 5,884
    • View Profile
    • Donate to Member
Re: NANY 2017: MMAHW! (Make My Active Hours Work!) - Cancelled
« Reply #7 on: January 05, 2017, 06:39 AM »
That particular script solves a different problem, i.e. disabling reboots.  The purpose of this program was to allow you to set your active hours to longer than 12 hours,

But what would be the actual reason for why anyone would want to do that, if not to prevent unwanted, unexpected, forced reboots?  :tellme:

wraith808

  • Supporting Member
  • Joined in 2006
  • **
  • default avatar
  • Posts: 11,186
    • View Profile
    • Donate to Member
Re: NANY 2017: MMAHW! (Make My Active Hours Work!) - Cancelled
« Reply #8 on: January 05, 2017, 06:58 AM »
That particular script solves a different problem, i.e. disabling reboots.  The purpose of this program was to allow you to set your active hours to longer than 12 hours,

But what would be the actual reason for why anyone would want to do that, if not to prevent unwanted, unexpected, forced reboots?  :tellme:

I don't care if it reboots.  If I turn off reboots, then I'm likely not to do it for a long while.  And if it installs and doesn't reboot, no other windows installer based installers will work because it will have pending installer actions.  I just want to shorten the window.  Right now I have it so it doesn't reboot, and a few times I've either not been able to install something, or had strange effects because I haven't rebooted yet.

app103

  • That scary taskbar girl
  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 5,884
    • View Profile
    • Donate to Member
Re: NANY 2017: MMAHW! (Make My Active Hours Work!) - Cancelled
« Reply #9 on: January 06, 2017, 06:07 AM »
Right now I have it so it doesn't reboot, and a few times I've either not been able to install something, or had strange effects because I haven't rebooted yet.

That's an effect I had not considered, mainly because I have not experienced that, myself.

wraith808

  • Supporting Member
  • Joined in 2006
  • **
  • default avatar
  • Posts: 11,186
    • View Profile
    • Donate to Member
Re: NANY 2017: MMAHW! (Make My Active Hours Work!) - Cancelled
« Reply #10 on: January 06, 2017, 06:18 AM »
http://superuser.com...tarting-visual-studi
https://technet.micr...360(v=exchg.80).aspx

There are quite a few threads out there on this issue, but no real authoritative source; I guess because they don't really want you to get around it.

On another point, it would seem that these scripts that were posted above should be more rightly posted in the Windows 10 thread, as most won't see them in this thread dedicated to a NANY entry.  And I've posted what I did to get it not to reboot there, and am using it currently.  Just a thought.

Deozaan

  • Charter Member
  • Joined in 2006
  • ***
  • Points: 1
  • Posts: 9,747
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: NANY 2017: MMAHW! (Make My Active Hours Work!) - Cancelled
« Reply #11 on: February 20, 2017, 07:15 PM »
Wasn't sure where to post this, so this thread seemed most related: Sjc1000 recently linked to an article in the IRC channel which says there will be an update which allows Windows 10 Pro/Enterprise to set Active Hours to 18 hours instead of only 12. So that's an improvement.

https://ctrl.blog/en...windows-active-hours