Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a 'long-running' (run at startup, don't terminate) scheduled task set up to run on a server.

When I remote-desktop into the server using the same domain account as the scheduled task, and then log out of the server, the scheduled task is terminated.

Is there a way to avoid this happening?

I'm running this task under my domain account, so that it has the domain network-share permissions necessary to do its work.

share|improve this question
    
Are you sure it's actually starting during startup? Do you by chance have Run only if logged on selected? –  squillman Sep 1 '11 at 13:53
    
No that's unchecked. Here's my workflow: I start the scheduled task manually while connected via remote desktop, then log off - the task stops working (I can tell because it's an HTTP server) and then when I connect again I can see it's not running. So in fact I haven't tested whether it starts when the server starts up. Possibly it would, but then it would always be stopped at the point I log off after connecting via remote desktop (I think I've seen that behaviour). –  mackenir Sep 1 '11 at 13:55
1  
Possibly I need to suck it up and implement a windows service... –  mackenir Sep 1 '11 at 13:55

1 Answer 1

If you start the scheduled task manually then it's running within the context of your interactive session and thus will end when your interactive session ends (ie- logout). If it's getting run during startup, outside of an interactive session, then it shouldn't die when you log out of an interactive session. The fact that it's running successfully when you start it manually leads me to believe that it's NOT running successfully during startup, assuming the HTTP server is listening on a static port. If it was running at startup then you'd get a port in use exception when you start the process manually.

If this is for more of a long term solution then I would concur that you should bake it into a service.

share|improve this answer
1  
"If it's getting run during startup, outside of an interactive session, then it shouldn't die when you log out of an interactive session." I need to test this, but from past experience I believe that even if a task is started outside an interactive session, if an interactive session is initiated with the same credentials, and then terminated, any tasks using the same credentials get killed off. I have used srvany.exe to make this app a poor man's windows service. –  mackenir Sep 2 '11 at 11:09

Your Answer

 
discard

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.