-
-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create scheduled task to move active hours
- Loading branch information
1 parent
f4d5056
commit 12c43bf
Showing
5 changed files
with
69 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
HKLM = &H80000002 | ||
key = "SOFTWARE\Microsoft\WindowsUpdate\UX\Settings" | ||
Set reg = GetObject("winmgmts://./root/default:StdRegProv") | ||
current = Hour(Now) | ||
reg.SetDWORDValue HKLM, key, "ActiveHoursStart", ( current + 23 ) Mod 24 | ||
reg.SetDWORDValue HKLM, key, "ActiveHoursEnd", ( current + 11 ) Mod 24 | ||
reg.SetDWORDValue HKLM, key, "SmartActiveHoursState", 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task"> | ||
<Triggers> | ||
<BootTrigger> | ||
<Repetition> | ||
<Interval>PT4H</Interval> | ||
<StopAtDurationEnd>false</StopAtDurationEnd> | ||
</Repetition> | ||
<Enabled>true</Enabled> | ||
</BootTrigger> | ||
<RegistrationTrigger> | ||
<Repetition> | ||
<Interval>PT4H</Interval> | ||
<StopAtDurationEnd>false</StopAtDurationEnd> | ||
</Repetition> | ||
<Enabled>true</Enabled> | ||
</RegistrationTrigger> | ||
</Triggers> | ||
<Principals> | ||
<Principal id="Author"> | ||
<UserId>S-1-5-19</UserId> | ||
<RunLevel>LeastPrivilege</RunLevel> | ||
</Principal> | ||
</Principals> | ||
<Settings> | ||
<MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy> | ||
<DisallowStartIfOnBatteries>true</DisallowStartIfOnBatteries> | ||
<StopIfGoingOnBatteries>true</StopIfGoingOnBatteries> | ||
<AllowHardTerminate>true</AllowHardTerminate> | ||
<StartWhenAvailable>false</StartWhenAvailable> | ||
<RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable> | ||
<IdleSettings> | ||
<StopOnIdleEnd>true</StopOnIdleEnd> | ||
<RestartOnIdle>false</RestartOnIdle> | ||
</IdleSettings> | ||
<AllowStartOnDemand>true</AllowStartOnDemand> | ||
<Enabled>true</Enabled> | ||
<Hidden>false</Hidden> | ||
<RunOnlyIfIdle>false</RunOnlyIfIdle> | ||
<WakeToRun>false</WakeToRun> | ||
<ExecutionTimeLimit>PT72H</ExecutionTimeLimit> | ||
<Priority>7</Priority> | ||
</Settings> | ||
<Actions Context="Author"> | ||
<Exec> | ||
<Command>C:\Windows\System32\wscript.exe</Command> | ||
<Arguments>C:\Windows\Setup\Scripts\MoveActiveHours.vbs</Arguments> | ||
</Exec> | ||
</Actions> | ||
</Task> |