Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

we have a server which is running WinSrv 2008 (not R2). There is a scheduled task on this server which runs at startup and just runs continuously, waking on an interval per a db setting to do work and then go back to sleep (the client wanted to be able to control the interval through a related website, which is why it is done as a continual-run app instead of using Task Scheduler's timing).

There is a problem with the app though which only happens after hours and hours of running, which makes it hard to try to debug in the code because it always runs fine and I can't sit around and just wait for my code for hours and hours.

Before I go putting in a massive state-debugger after every line or something, I'm wondering is there any way which I can log in to the server and see the actual program that is running under Task Scheduler?

What I mean is, by running the task in Scheduler, it runs in a sort of invisible, background login session. Is there any way to "adopt" it into my login session so that I can see the program window as it is currently running, so I can see the state of it?

share|improve this question
up vote 2 down vote accepted

First of all, I must chastise you for not writing this app as a native windows service. It is designed to run at startup, in the background, with no user interaction, forever (barring admin intervention). That's a textbook case of what a windows service does. Abusing the functionality of the Task Scheduler to start an app that runs forever is just sloppy/lazy programming. There are plenty of pre-written templates out there you can likely use for whatever language your app is using I'm sure.

All that said, why not just run this app manually on the server in the console session where you can already see it and just wait for it to fail like it normally does?

share|improve this answer
It actually is a UI program which also can be run on demand as needed. – eidylon Sep 13 '10 at 16:17
@eidylon: then just start it manually, let its window pop up, wait for it to fail and go to the screen to see what happened... – Massimo Sep 13 '10 at 20:41
If it was failing in short order that'd be easy enough, but it takes hours and hours before it fails, often late in the night. – eidylon Sep 13 '10 at 23:55
What prevents you from seeing the screen late in the night? RDP is your friend. – Ryan Bolger Sep 14 '10 at 22:57

If you run Process Explorer from Microsoft you should be able to see processes that have been spawned from the Task Scheduler process i.e from svchost.exe. If you right click the relevant process and if applicable you may have the option to switch to the Window. However, I think this is dependant on your application. It may also be worth considering using the Event Viewer or a log file to try and determine what is causing the problem.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.