Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I wrote a temperature logger program and entered it as a scheduled task in Windows XP.

So far, I was able to achieve this objective:
1. Get the task to run even before anyone logs in (i.e. at the "Press Ctrl-Alt-Del" screen)

But I'm having problems with these:
1. When I log in, log out, then log back in, the scheduled task is no longer active. I can no longer see it in the Task Manager's Processes tab. I suspect it closes when I log out.
2. I tried to set the task's "Run As..." property to DOMAIN\my-username and also tried SYSTEM, but problem #1 above still persists.

SUMMARY:
I want my program to be running as long as Windows is active.

EDIT 1:
My program is actually a Python script. So its command line in Scheduled Tasks is:

C:\Python26\pythonw.exe "C:\path\to\templogger.py"

It writes data to a file in local public folder (e.g. fully accessible by all who login locally).

share|improve this question
add comment

2 Answers

up vote 3 down vote accepted

The best approach for this is to run it as a service. You can probably get away with it just by using Sc.exe.

share|improve this answer
    
To add to this: yes, I would write it as a service, but I would also still use scheduled tasks to simply control starting or stopping the service. –  Joel Coehoorn Aug 19 '10 at 3:20
    
Can I avoid writing it as a service? I don't know anything about writing programs as Windows services. My program is a Python script. See EDIT 1 above. –  Kit Aug 19 '10 at 6:32
    
Its pretty easy to do. First you need srvany.exe which comes with windows resource kit. Second, either use freeware or command line to create the service. Then add to the registry for that service. Ive had to do this to run python scripts headphones, sickbeard or ouchpotato as windows services. –  crosenblum Feb 28 '13 at 2:23
    
NSSM (nssm.cc) is better than srvany.exe. I have used to it run a python script as a service with no issues, just make sure your paths are correct. –  ultrasawblade Aug 22 '13 at 19:50
add comment

Have you tried giving the user "log on as a batch job" and "log on as a service" rights ?

share|improve this answer
    
ntrights.exe from the resource kit can give an account this privilege if I'm not mistaken. –  ultrasawblade Aug 22 '13 at 19:51
1  
Instead of phrasing this as a question, you should phrase it more as an answer ;) –  KronoS Aug 22 '13 at 19:53
add comment

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.