Scheduled Task to show console window when logged on but still run when not logged on

Posted by HeartWare on Server Fault See other posts from Server Fault or by HeartWare
Published on 2010-08-23T08:45:37Z Indexed on 2011/11/28 1:53 UTC
Read the original article Hit count: 669

Is it possible (and if so, how) to set up a task (console application) in Server 2008 so that it'll run both when a user is logged in and when no user is logged in, AND - if the user is logged in (either local or via RDP) - have the console appear on the screen while the program is running?

Ie. the program should run under the defined user context and it writes status messages to stdout, which goes to a standard console window. This console window is either shown (if the defined user is currently logged in locally or via RDP), or not shown (but the application is still run).

I have access to the source of the console application, so if it needs some additional code (like specifically opening up a new console window or what have you), then that's not a problem.

At the moment, I can set up the task as "Run only when user is logged on" which will run the application when the user is logged on (local or RDP) and I can then see the status messages, or I can set it up as "Run whether user is logged or not" and no status output is visible - not even if the user is logged on.

© Server Fault or respective owner

Related posts about windows-server-2008

Related posts about scheduled-task