If you manage Windows servers you are probably familiar with the Scheduled Tasks service. While not the fanciest job scheduler in the world, it is loaded with a decent set of features and, since it ships with the OS, arguably a lot cheaper than some of the third party options.
I use scheduled tasks a lot. Anything that needs to be done periodically tends to become a task. Why should I do that stuff manually?
Did you know that scheduled tasks are really just files? And since they are just files, you can copy them.
For example, suppose you want to copy that “Restart IIS” task from one server to another. First copy it out of the Scheduled Tasks folder to somewhere else (perhaps the Desktop). Copy and Paste works best – if you drag a job out of Scheduled Tasks you’ll be moving it and removing the task.
Now copy it to the other server and then drag it into Scheduled Tasks. Done! This saves me tons of time when configuring the maintenance stuff on a new server. I can setup a whole fleet of tasks in just a few clicks.
One small caveat: The task will run as whatever user copies it into the scheduler. Often, folks will change the “Run As” property on the task – if you do, be sure to check that after the final copy!
![]()
Want to make sure your complex tasks get backed up? Select them all, copy them and paste them into a directory that is already on a scheduled backup. Simple as that. Or heck, toss them onto a USB drive or burn them to CD. Again, they’re just files with a .job extension.
You can even toss scheduled jobs into the version control software of your choice. You do have the extra step of copying them from the Scheduled Tasks view though.
Any other good scheduled tasks tricks or tips?
Possibly Related posts:







That’s awesome, should save me a lot of time. Thanks!
Its not really a scheduled task trick, but on the firefox browser, there is a plugin called “iMacro”, which allows the same task to be repeated, or sheduled in a different order. Its a timesaver to
I copied the files tothe new server. However they dont run on schedule.
When I tried to see what’s going on, it prompted me to re enter the password (which is the same as my principal server). Only then did the task run on time.
I have more than 130 tasks!!! That’s 260 password entries!
Can anyone help?
@amine – not sure what to suggest without more details. It sounds like the two machines aren’t in the same domain or you’re using different user credentials on them?
That’s definitely a bummer! Maybe try to re-drag the tasks to the second machine when logged on as the user that you want running them?
Thanks Chris for such a quick response!
You’re right, I connected the backup server to the main one with different credentials (duh). So replicated them; but it still won’t do.
My senior manager is telling me copying *job wont paste the password between servers because it’s a security breach (in other words Windows wont let me do it). I just can’t believe (perhaps because I m stubborn) that there isn’t a way to automate this.
So here is what I did:
BOX A (main server) and BOX B (backup srvr)
T drive on BOXB is mapped to C: on BOXA
I browse to T:\windows\tasks
I copy all *.job files to C:\windows\tasks on BOXB
I run my scheduler and I see those tasks.
I right clik on one, select run
password prompt pops
Knowing that BOXA and BOXB use the same passwords all over, how can I get these jobs to run without going through the hassle of retyping the pass twice for each newly copied task.
When copying the tasks, when not in the same domain, you need to re-enter the password. What you can do, probably not very helpful to you right now, but you can use the command line (script it) to create your scheduled tasks using SCHTASKS. That way, you don’t need to back up your tasks, just your .bat or .cmd file. It also makes setting up scheduled tasks on multiple machines pretty easy.
When you copy a .job scheduled task file from one machine to another the task runtime credentials of the job from which you copied do not go with the .job file. (Windows security pain in the as*… I mean feature). Also it was stated earlier in this post that the credentials that show up on the new implementation are those of the user who initiated the copy. That is not correct. The credentials that show up when you look at the copied job are those you are currently logged in with. (try looking at the copied task with two different log-ins to prove this if you wish).
I have worked around this by using the “schtasks” command line to create the same task on multiple machines at once. It allows you to specify and persist the task runtime credentials used when the task executes. So you can create a .bat or .cmd file that looks something like this:
schtasks /create /tn task1 /tr C:\Monitoring\script.vbs /sc DAILY /st 10:00:00 /s \\server1 /u domain\user /p pword /ru domain\user /rp pword
Put a line like this in your .cmd file for each server you want to implement the task on and you are good to go.
Cheers.
Are you familiar with any method for scheduling a task to run more frequently than every minute, besides a nasty custom solution. Is there any out of the box software which enables this?
As you found the scheduled task GUI does not let you specify run times more frequently than 1 minute. (bummer) Because the schtasks command documentation says the following:
/st StartTime Specifies the time of day that the task starts in HH:MM:SS 24-hour format. The default value is the current local time when the command completes. The /st parameter is valid with MINUTE, HOURLY, DAILY, WEEKLY, MONTHLY, and ONCE schedules. It is required with a ONCE schedule.
I tried creating 2 tasks. One starting at 15 seconds after top of minute and one starting at 30 seconds after top of minute. Unfortunately this does not work. The 2 tasks were both successfully created but both reverted to running at the SS=00. In other words the command ignores the start second parameter and defaults to top of minute.
So you may be left to having to do something custom. One caveat being that if you are trying to do something that can be done by using performance monitor alerts, those actions can run as frequently as every second.
D.
This has stumped for a few years and while I’m usually able to get away with a one-minute wait, I can’t accept it for this project. Based on your expertise, let me know what you think. I need to fire a process as soon as possible to the time when a file is dropped in a directory. There are a few options to explore:
1.) I’ve never heard of a way to auto-fire an event, like I would do easily with an event sink, when a file is saved to a directory. In fact, I’m using an event sink to drop the file in the folder in real-time as the email is received but then I have to wait!
2.) I can create a custom script which fires once per minute and checks the folder for files before deciding to proceed. The process of checking an empty folder for the presence of any files will take < 20 ms w/ no roundtrips or logging so I'm not too worried about a performance impact. Then I can have it sleep (Wscript) for about 5 seconds until it checks again. I'll run that until the script has been running for 55 seconds and then quit before it starts up again. If it finds a file, it runs the full process. If not, it just sleeps or quits.
3.) Is there any third-party software which can run a task (WSH file) more frequently than every minute?
What I do is have the process that puts the file in the folder initiate the event that needs to happen next. In that way you don’t have to resort to polling and latency is minimized. The process that drops the file does not actually need to do the post file processing. It just needs to publish an event that can be recieved (listened for) by whatever process then needs to act on the file.
I’m sure you can find some open source software to handle events more frequently than every minute though I do not have any reccomendations.
D.
Scheduled tasks make sense for things that should be run once a week/day/hour, but when you want to run more frequently than that, why don’t you just launch the script (using a scheduled task) and then have the script sleep between loops? Just have the script run a while loop with a sleep at the top/bottom of the loop, so that it continually runs itself as often as you like?