+ Reply to Thread
Results 1 to 10 of 10
  1. Senior Member
    Join Date
    Nov 2007
    Location
    Norway
    Posts
    232

    Certifications
    MCTS, MCSA
    #1

    Default Schedule a task for when computer is idle

    Hello guys,

    I'm having difficulties scheduling a task for when computer is idle. What I want to do is run a task after the computer has been idle for five minutes. I've tried creating a scheduled task in different ways, which will do this, but to no avail.

    I go to Task scheduler to create a task:

    General Tab
    Give the task a name, put the check box to run with the highest priv., and configure it for Win 7.

    Triggers Tab
    New, Begin the task on idle, Repeat task for 15 minutes indefinitely, Enabled.

    Action Tab
    Start whatever program.

    Conditions Tab

    Start the task only if computer is idle for 5 minutes. Do not wait for idle.

    The settings I have not described stay default.

    Now from what I can gather from this is that every 15 minutes, the computer will run the task if the computer stays idle for 5 minutes. Say, I start the computer and leave it like that, then the task should run after 5 minutes. Then after 10 minutes, it will once again start checking to run the task.

    But this just does not work. If I leave the computer idle for even 7 minutes after startup, nothing happens. What am I doing wrong?
    Reply With Quote Quote  

  2. SS -->
  3. Senior Member Devilsbane's Avatar
    Join Date
    Apr 2010
    Posts
    4,203

    Certifications
    MCSE:Security, MCDST, A+, Network+, Security+, ITIL V3 Foundations, ITIL 2011 Intermediate: Service Transition, MOS 2007 (MCAS) BAS Computer Forensics
    #2
    I don't think you need that repeat task every 15 minutes.

    You just need to have the trigger to start the task. Also, check the logs. Maybe it isn't starting because user credentials are wrong. Or maybe the path to the application isn't valid. Log files will spell this out.
    Reply With Quote Quote  

  4. Senior Member
    Join Date
    Nov 2007
    Location
    Norway
    Posts
    232

    Certifications
    MCTS, MCSA
    #3
    Quote Originally Posted by Devilsbane View Post
    I don't think you need that repeat task every 15 minutes.

    You just need to have the trigger to start the task. Also, check the logs. Maybe it isn't starting because user credentials are wrong. Or maybe the path to the application isn't valid. Log files will spell this out.
    Well, I tried the task now, and for some strange reason, now it did run. The path is just fine, because I can always just click run to test the task. Also, the user credentials really should not be an issue, as I am just trying to kill some processes, and start a new process. The processes that I am trying to kill are just some apps that are running. And the task I am starting is iexplore.exe (IE9). The batch file itself works just fine, as I have tested it several times. Logged on with different users.

    What exactly does "Repeat task for 15 minutes indefinitely" do? I am assuming that unless I set this option, the task will only run once?

    I also am not quite getting the "Start the task only if computer is idle for 5 minutes". "Do not wait for idle". options, and technet really does not explain that very well.

    Perhaps the reason I am having trouble running the task is because Win7 needs to have its cpu usage lower than 10%, for it to consider the computer in idle state?
    Reply With Quote Quote  

  5. Senior Member
    Join Date
    Nov 2007
    Location
    Norway
    Posts
    232

    Certifications
    MCTS, MCSA
    #4
    And now its not working anymore. Quite frankly, I am getting sick of the task scheduler. Is there any way I can run a batch file the moment the screen saver is launched? That way I can just set the screen saver to kick in after five minutes, and have this batch file kill those processes.

    Basically its a kiosk pc, where the customer wants the processes to be killed and iexplore to start with the start page after five minutes inactivity.
    Reply With Quote Quote  

  6. Senior Member Devilsbane's Avatar
    Join Date
    Apr 2010
    Posts
    4,203

    Certifications
    MCSE:Security, MCDST, A+, Network+, Security+, ITIL V3 Foundations, ITIL 2011 Intermediate: Service Transition, MOS 2007 (MCAS) BAS Computer Forensics
    #5
    "Idle" is based on no mouse/keyboard activity. User credentials are still important, the task has to run under someone. Even if the task was to run calc.exe (which I often use to test my schedules because it isn't going to break anything and makes it clear whether it worked) credentials are needed.

    I haven't done much work with scheduler in windows 7, so my thinking is mostly going off XP.
    Reply With Quote Quote  

  7. Senior Member Jander1023's Avatar
    Join Date
    Jul 2010
    Location
    Arizona
    Posts
    160

    Certifications
    MCITP:SA, A+, Network+, 70-620, 70-680, 70-685, 70-686, 70-640, 70-642, 70-646
    #6
    Try changing the User or Group to "SYSTEM" and check the run with highest privileges option. These options are available on the properties dialog for the task. Let me know if this works.
    Reply With Quote Quote  

  8. Senior Member
    Join Date
    Nov 2007
    Location
    Norway
    Posts
    232

    Certifications
    MCTS, MCSA
    #7
    Devilsbane, I understand that I need to provide user credentials, but what I meant is that it should not be necessary to provide admin credentials for this task.

    Jander1023, I tried to set the user as system, but still the task would not run properly. I think this has something to do with task scheduler wanting the cpu usage to be lower than 10% for it to run a task after x minutes of idle time. I don't know for sure though.

    But in any case, I got sick of the task scheduler, and have found a way around it. I downloaded a batch to exe converter Bat To Exe Converter , then converted the batch file to exe, renamed the .exe to .scr extension, and set the file as screensaver. Now the screen saver is absolutely awesome in every way possible, because it runs the task just as I want it to.

    Conclusion, Screen Saver is king, Task Scheduler is overrated (when it comes to running tasks after x minutes of idle time).
    Reply With Quote Quote  

  9. Senior Member Devilsbane's Avatar
    Join Date
    Apr 2010
    Posts
    4,203

    Certifications
    MCSE:Security, MCDST, A+, Network+, Security+, ITIL V3 Foundations, ITIL 2011 Intermediate: Service Transition, MOS 2007 (MCAS) BAS Computer Forensics
    #8
    Quote Originally Posted by Dracula28 View Post
    But in any case, I got sick of the task scheduler, and have found a way around it. I downloaded a batch to exe converter Bat To Exe Converter , then converted the batch file to exe, renamed the .exe to .scr extension, and set the file as screensaver. Now the screen saver is absolutely awesome in every way possible, because it runs the task just as I want it to.
    Never heard of this, but I will be certainly stealing it. Thanks for the heads up!
    Reply With Quote Quote  

  10. Senior Member
    Join Date
    Nov 2007
    Location
    Norway
    Posts
    232

    Certifications
    MCTS, MCSA
    #9
    And if you want to have a regular screen saver, you can just have the batch call it up at the end (or at the start I presume) from c:\windows\system32\nameofscreensaver.scr. I must say I've learned a lot trying to create this Windows 7 kiosk. A lot of things that were never mentioned on the exam or the TK. It did come at the worst possible time though, as I was thinking of taking 640 next Wednesday, but have pretty much used last week just setting up and configuring a bunch of kiosks. Also, someone broke into my house this week, and stole some jewelry and cash (not much of the latter though).

    Btw, here is the batch file I've created (window will be minimized)

    Code:
    if not "%minimized%"=="" goto :minimized
    set minimized=true
    start /min cmd /C "%~dpnx0"
    goto :EOF
    :minimized
    TASKKILL /F /IM nameoftask.exe /FI "STATUS eq RUNNING"
    TASKKILL /F /IM nameoftask.exe /FI "STATUS eq RUNNING"
    TASKKILL /F /IM nameoftask.exe /FI "STATUS eq RUNNING"
    start iexplore
    If you want to completely hide the cmd window from showing, you can have this vbs call up the batch file

    Code:
    Const HIDDEN_WINDOW = 12
    
    strComputer = "."
    Set objWMIService = GetObject("winmgmts:" _
        & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
    Set objStartup = objWMIService.Get("Win32_ProcessStartup")
    
    Set objConfig = objStartup.SpawnInstance_
    objConfig.ShowWindow = HIDDEN_WINDOW
    Set objProcess = GetObject("winmgmts:root\cimv2:Win32_Process")
    errReturn = objProcess.Create("nameofbatchfile.bat", null, objConfig, intProcessID)
    Just remember to either put the batch file in c:\windows\system32, or edit the vbs to include the path where you want to call the batch file from. Obviously you can use this vbs to hide any process/application.
    Last edited by Dracula28; 06-24-2011 at 09:25 PM.
    Reply With Quote Quote  

  11. Senior Member Jander1023's Avatar
    Join Date
    Jul 2010
    Location
    Arizona
    Posts
    160

    Certifications
    MCITP:SA, A+, Network+, 70-620, 70-680, 70-685, 70-686, 70-640, 70-642, 70-646
    #10
    Quote Originally Posted by Dracula28 View Post
    Devilsbane, I understand that I need to provide user credentials, but what I meant is that it should not be necessary to provide admin credentials for this task.

    Jander1023, I tried to set the user as system, but still the task would not run properly. I think this has something to do with task scheduler wanting the cpu usage to be lower than 10% for it to run a task after x minutes of idle time. I don't know for sure though.

    But in any case, I got sick of the task scheduler, and have found a way around it. I downloaded a batch to exe converter Bat To Exe Converter , then converted the batch file to exe, renamed the .exe to .scr extension, and set the file as screensaver. Now the screen saver is absolutely awesome in every way possible, because it runs the task just as I want it to.

    Conclusion, Screen Saver is king, Task Scheduler is overrated (when it comes to running tasks after x minutes of idle time).
    Well, sorry my suggestion didn't help. However, I'm glad you found an alternative solution. Unfortunately, task scheduler isn't covered in much detail on any of the Windows 7 certification tracks. I use task schedule at work but only for basic tasks that aren't idle time related.

    Now I'm curious how Win7 works with idle time and task schedules. I'll dig a little bit next week while at work, time permitting. If I find anything, I'll be sure to post it here.
    Reply With Quote Quote  

+ Reply to Thread

Social Networking & Bookmarks