Solved

schtasks - single task, multiple dates

Posted on 2011-03-10
1
1,118 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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Join & Write a Comment

Preface Having the need * to contact many different companies with different infrastructures * do remote maintenance in their network required us to implement a more flexible routing solution. As RAS, PPTP, L2TP and VPN Client connections are no…
This may not be a text book method to resolve VSS backup issues but it seemed to have worked on few of the Windows 2003 servers we had issues while performing a Volume Shadow Copy backup. If you have issues while performing a shadow copy backup usin…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

744 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now