Solved

schtasks - single task, multiple dates

Posted on 2011-03-10
1
1,129 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

I guess it is not common knowledge to most Wintel engineers/administrators: If you have an SNMP-based monitoring system in your environment (and it's common to have SNMP or Syslog) it's reasonably easy to enable monitoring of the Windows Event logs,…
Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
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…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

756 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