Windows scheduler - Tasks not running when user not logged in

22,159

Solution 1

A couple of things to check:

Make sure that the task you are scheduling has the Run only if logged in option unticked.

Ensure that the Task Scheduler is set up to interact with the desktop

  1. Click Start, click Control Panel, and then double-click Administrative Tools.
  2. Click Computer Management.
  3. Expand Services and Applications, and then click Services.
  4. Right-click the Task Scheduler service, and then click Properties.
  5. On the General tab, make sure that the startup type is set to automatic, and that the service status is Started. If the service is not running, click Start.
  6. On the Log On tab, make sure that the local system account is selected, and that the Allow service to interact with desktop check box has a check mark.
  7. Click OK, and then quit Computer Management

If you want to use the localsystem account to run the scheduled tasks instead of a user account then you need to use the SCHTASKS tool (e.g a task running on the server locally and not needing to use network resources etc)

Solution 2

You need to grant "Run as Batch Job" permission to the user that you are running the task as. It is in the Local Security Policy

Share:
22,159

Related videos on Youtube

Glinkot
Author by

Glinkot

Updated on September 18, 2022

Comments

  • Glinkot
    Glinkot over 1 year

    I have Windows Server 2003, with schedules setup via Remote Desktop under one account. That account appears in the 'creator' column too. I have 'Run only if logged on' unticked.

    When I have logged in under that account and then 'disconnected' leaving the the session alive, the schedule runs. But every time the server is rebooted, the task again fails to run until I again log in and disconnect.

    Any KB fixes I've missed or issues I've overlooked? Normally I only discover the issue when a user tells me the schedule has stopped running so it's a real reliability issue.

    I'd also be happy with an answer suggesting an alternative scheduler with higher reliability.

    Thanks

    • Ƭᴇcʜιᴇ007
      Ƭᴇcʜιᴇ007 over 12 years
      Does it fail to run, or run and then fail? What's the Last Run Result code reported by the Task Scheduler after it attempts to run while you're not logged in?
    • Glinkot
      Glinkot over 12 years
      It says 0x0 (success) normally. In fact, when I try to run it from the other account I use, it says it's run and returns 0x0 even though it hasn't executed.
    • Admin
      Admin over 12 years
      We need more information about the rest of the sheduled task. For instance, have you set it to run at highest privileges? Did you tell it to run when only certain parameters are true? Have you deleted and recreated the task with the same outcomes?
    • Glinkot
      Glinkot over 12 years
      Hi. Both the accounts are localadmin accounts. I'm not aware of a setting to run the task itself at a different privelege level - if so where is it and I'll have a look. I have this issue with several tasks, some of which I've recreated with the same result unfortunately.
    • surfasb
      surfasb over 12 years
      I added an edit to my answer. The facts in your question and comments seem contradictory.
    • Glinkot
      Glinkot over 12 years
      Hi, I added a comment to clarify, there is no contradiction so far as I can see at the moment. cheers
  • Glinkot
    Glinkot over 12 years
    Hi, the task just runs a .bat file which in turn runs an .exe file. No, if it is run under another remote session it doesn't work even if the other user is logged in. :( Good to see we have an IT/singing expert on board!
  • surfasb
    surfasb over 12 years
    @Glinkot: Strange. What does the exe do?
  • Glinkot
    Glinkot over 12 years
    Hi. Re your edit: I didn't say it works from the second account. For clarify, let's say the account it's setup under is called 'automate' (which it is!) and the second mfoley (which it is!). Logging in remotely as automate and manually running it, works. Logging in as automate, then disconnecting, leaves the schedule running. Running manually from mfoley account returns 0x0 but doesn't actually execute. Restarting causes the schedules to no longer run, until I have logged into RDP as automate and disconnected again. The exe copies/encrypts files, from folders both accounts can access.