1

I set a new scheduled task to start "when my computer starts". I assigned an Administrator user to run the task. This is an executable that is supposed to run indefinitely in the background.

The problem is, that if the Administrator logs in and then logs off, the task stops running.

Is there a solution for this?

UPDATE: this was caused because the task running was in java. See my own solution.

Ovesh
  • 444

2 Answers2

1

This happened because the task running was a java application. Java intercepts user logoff events and stops execution. This is solved by adding -Xrs to the command line running the application, causing the JVM to ignore the logoff event.

Ovesh
  • 444
  • Glad you figured it out. Make sure to mark your own answer as accepted so people know the question has been solved ;) – nhinkle Jul 19 '10 at 17:48
0

What does the program do, and what level of access does it use? You might be better off running the task from one of the Service user accounts (LocalService, NetworkService or LocalSystem). This will cause the task to run under a system account which does not interact with the desktop, and does not load a regular user's profile. It also means it won't be affected by users logging on and off, since these accounts are perpetually "logged on". Just be careful: the LocalSystem account in particular has essentially complete system access, meaning that if whatever your task is running were to somehow become accessible to a user, they could potentially gain full access to the system.

nhinkle
  • 37,390
  • I can't assign any of the users you suggested. From what I see in the documentation you referenced, these users are intended for use with services (service control manager), which as far as I know, is not Scheduled Tasks. Please correct me if I'm wrong. I also forgot to mention, I'm on Windows 2003. – Ovesh Feb 18 '10 at 07:40
  • Ah, I'm sorry. I'm used to the revamped task scheduler in Server 2008 and Windows 7, where you can select it to run as one of the system accounts. I just booted up an XP VM and checked, and you are correct, it doesn't appear possible to do in older versions of windows. Sorry for overlooking that. – nhinkle Feb 19 '10 at 08:09