Scheduled Tasks - how do I handle a user log off?

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

Posted 2010-02-18T07:06:43.897

Reputation: 384

Answers

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

Posted 2010-02-18T07:06:43.897

Reputation: 384

Glad you figured it out. Make sure to mark your own answer as accepted so people know the question has been solved ;) – nhinkle – 2010-07-19T17:48:37.373

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

Posted 2010-02-18T07:06:43.897

Reputation: 35 057

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 – 2010-02-18T07:40:25.537

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 – 2010-02-19T08:09:50.600