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 am a programmer designing a solution to a problem that we are having. I was thinking about writing an app and using Windows Scheduled Tasks to run it once per day or so as opposed to writing a service that would sleep most of the time and wake up once per day to do it's thing. But my question is do admins typically use Windows scheduled tasks?

The application would be to delete old files that we generate and cannot clean up any other way (for good reasons).

share|improve this question

6 Answers 6

up vote 5 down vote accepted

I would agree with others in that scheduled tasks would be appropriate for your needs. I would add though (as a programmer myself) that as a scheduled task, either have some sort of confirmation be sent to you (email?) that the task ran successfully and/or append results to a log file somewhere for potential troubleshooting. Doing some sort of reporting/logging/auditing always comes in handy should you need it.

share|improve this answer
1  
It's also not terribly hard to start out with a simple cmd line app that runs as a scheduled task and then convert it into a service if the project scope changes and it makes sense to do so. –  Ryan Bolger Jul 28 '09 at 16:13
    
Good point. Start simple and build into more complex mechanisms to achieve your goal. –  osij2is Jul 28 '09 at 18:33

Here's how I decide...

Services are for running "constant" operations all the time.

Scheduled Tasks are for running single units of work at scheduled intervals (what you want). Really, Scheduled Tasks itself is a service already.

Don't write a service that duplicates the Scheduled Task functionality. :)

share|improve this answer

I would say that for a once-a-day operation like that, scheduled tasks are fine. I use them for various reasons throughout our network. Having a bunch of services running, even if they are idle most of the time, still uses some system resources. Services, IMHO, should be used for things that need to run continuously in order to respond to events in in a timely manner or communicate with other network services as needed.

share|improve this answer

Like so many questions given to solution developers, it depends. There's nothing wrong with using Scheduled tasks and as long as whatever solution you're developing clearly states in the documentation what/how you do something you should be fine. There are advantages for running something as a service such as being able to script a solution for a non-admin to run a service if they don't know how to use the services.msc console. Or even being able to monitor said service via Powershell or a network monitoring program such as What's Up Gold. With Scheduled task you can run your program on a schedule you decide but you can also add arguments (which you can also do with services technically) but you can do so in an easy GUI format. Again, whatever you decide is easiest and most useful for your situation.

share|improve this answer

The only problem with scheduled tasks is that once you get more than a handlful of machines to manage it's really easy to lose track of what's where. At which point you have to shell out for a task management program...

share|improve this answer

Another consideration would be if the machine/user will be staying logged on or not. You would want to test each scenario with each option depending on the solution you require.

share|improve this answer

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.