Task Scheduler event-based trigger active within certain time frame

0

I have successfully set up my task to run on event 4802 (screensaver) but it runs too often as I can be away for a while and ssaver can launch. Now the trigger definition looks like that

enter image description here

How to execute the task upon event triggering but only within certain time frame, e.g. 10pm - 10am?

Activate/Expire setting seems to be active only for specified day, how to enable it to do every day?

Suncatcher

Posted 2018-03-29T09:13:06.683

Reputation: 908

Answers

0

I solved the task by this powershell statement, considering our time frame is 8am-8pm:

if ([int](get-date -format HH) -gt 8 -or [int](get-date -format HH) -lt 20) {do smth}

The statement should be put in Action field of task properties before real action:

enter image description here

If one want to start something other than Powershell script, one should find an equivalent in PS though.

If somebody knows more elegant/Scheduler-native solution, the answers are welcome.

Suncatcher

Posted 2018-03-29T09:13:06.683

Reputation: 908