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?


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.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.