You are not logged in.
Pages: 1
I am trying to trigger a task whenever the computer goes idle. I need to do this in an install package, so I am using schtasks. I am able to create a task, but it only triggers once. I am expecting it to trigger again the next time the computer enters the idle state. Here is my code:
schtasks /create /tn "My Task Name" /tr "My Task To Run" /sc onidle /i 1 /ru SYSTEM
The task triggers and runs properly one time. What am I missing to get it to run again when the computer goes idle?
Thanks for any ideas.
Windows Shell Scripting and InstallShield
Offline
This question isn’t really a command line problem… I can only suggest carefully reviewing and tweaking the options from within the Task Scheduler GUI.
Offline
Pyprohly: We don't need to be that parochial
RG:
There's a fair bit of info about how "idle" is determined here, might provide some insight based on your environment/behaviours:
https://docs.microsoft.com/en-gb/window … conditions
Some other avenues to explore:
Do you see the same behaviour running "onidle" tasks against a named user, rather that "SYSTEM"?
On the vein of Pyprohly's comment, what behaviour do you see for tasks created via the GUI?
If GUI versions work, is there any visible difference in config between them when you do this?
schtasks /query /V
Last edited by bluesxman (26 Jun 2018 13:55)
cmd | *sh | ruby | chef
Offline
Thanks bluesxman.
Yes, I have been over the link you posted and this text in it (below) appears to be exactly what I want. However, it does not seem to work. It will trigger once and that is it.
"Cycling Idle Condition
If the computer is cycling in and out of the idle state, you can terminate and restart the task using the following idle conditions. To terminate and restart a task, both properties and elements must be set to True:
To terminate the task when the idle condition ends, set the StopOnIdleEnd property or the StopOnIdleEnd element to True.
To restart the task when the computer cycles into the idle condition again, set the RestartOnIdle property or the RestartOnIdle element to True."
BTW, same results achieved when done from GUI.
Last edited by RG (03 Jul 2018 20:50)
Windows Shell Scripting and InstallShield
Offline
Pages: 1