Solved

schtasks - single task, multiple dates

Posted on 2011-03-10
1
1,128 Views
Last Modified: 2012-05-11
Ok, riddle me this riddler!!!

Short story
I need a non-GUI method of creating a SINGLE task that runs on multiple dates/times, but the dates are non-standard (based on fiscal periods, so I would specify the dates).  This could be some type of xml, or a single line that with a bevy of parameters, or multiple lines, or whatever, but I dont want it to use the gui... all through the command line.

I know it can be done using the GUI... I've done it, but I need a way to automate this process.  I can create code that will create the script (or xml file or whatever) and I then save that script and run it when needed.

Long version
Lets say I have a program called "RunMe.exe" that accepts a parameter... so when I call it I will call it as "RunMe.exe 7" where 7 is the parameter.

My company does things in fiscal periods and I want Windows Scheduler to run this task at the start of every fiscal period (I have the fiscal lists, I dont need any method of calculating or pulling them automatically) at 10am

For this question.. without using the GUI, how can I create a schedule so that the task will run at 10am on May 1 2011, June 12, 2011, July 3 2011?

I already have the code to create tasks that run every monday and things like that, but I dont know how to do it for these fiscal periods.

I do NOT want a task for each fiscal period... so I dont want to look in the scheduler and see a bunch of tasks, such as:

"RunMe.exe 7" May 1
"RunMe.exe 7" June 12
"RunMe.exe 7" July 3

I want to open up the Windows Scheduler and see a single task, lets call it RunMe.  When I click on that task and go to the Schedule tab, I can see the list of dates(and times) that this task will run on.

I need something that looks like (which will run every day at 5:50am)
schtasks /create /s vServer1 /tn "RunMe 7" /tr "C:\SomeProgramDir\RunMe.exe 7" /sc weekly /d MON,TUE,WED,THU,FRI,SAT,SUN /st 05:50

I dont care if there are 3 lines.. the first line creates the initial task with date/time and the next two lines modify (or add or wahtever) the schedules dates to add the other two dates... or even an XML file or anything.

All I care is that when I am done running the single line, or 3 lines, or single line + xml or however its done, I have a single task with multiple different dates that I specify.

Is this possible at all or MUST it be done using the GUI?  I dont want to have to purchase any new schedulers or anything like that.  If it can NOT be done using the built-in Windows Scheduler, is there a free/safe/reliable windows scheduler replacement that I can use?  A different scheduler would only be my very last resort.

Thanks!



0
Comment
Question by:tfsaccount
1 Comment
 
LVL 1

Accepted Solution

by:
tfsaccount earned 0 total points
ID: 35096335
Ok, I figured this one out:
1) Go and use the GUI to manually create a task with some dates that you select manually
2) Export this into an XML file
3) Open up the XML file and change the dates to what you need
4) Use the /create and /xml options to create a new task with the dates specified in the XML file

Not the funnest method, but it works and I can save the XML file to use later on, all I need to do is change the times and the arguments and a few things like that.

0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

On July 14th 2015, Windows Server 2003 will become End of Support, leaving hundreds of thousands of servers around the world that still run this 12 year old operating system vulnerable and potentially out of compliance in many organisations around t…
While rebooting windows server 2003 server , it's showing "active directory rebuilding indices please wait" at startup. It took a little while for this process to complete and once we logged on not all the services were started so another reboot is …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question