schtasks.exe vs ITaskScheduler


I'm trying to write some code to automatically "configure" a bunch of scheduled tasks on a machine. The program will read an XML file then "configure" the run times etc. of the task based on the information in the XML file.

The idea should be that the program can be "run" multiple times on the machine and automatically "add/remove" any effective changes. The way I was wanting to do this was as follows:


All tasks will be created with some special "prefix". When the program runs, it "deletes" all tasks with that prefix as they can be assumed to have been run by the program with a different, early, configuration.

</li> <li>

The program then "creates" the new tasks.

</li> </ol>

So my "configuration" program needs be able to

<ol><li>Get a list of all existing scheduled tasks on the machine</li> <li>Delete tasks by name</li> <li>Create new tasks by name</li> </ol>

It will be simplest if I can write the program in C#.

There appear to be two ways I can do this:


The C# program explicitly runs the "schtasks.exe" program with appropriate command line parameters. It "reads" and parses the output of schtasks.exe to get the list of existing tasks so that it can delete them. It then runs schtasks.exe again to create the new tasks.

</li> <li>

Use the ITaskManager interface via a .NET COM wrapper to programmatically query and schedule the tasks.

</li> </ol>

I'd prefer to go with #2 but I have a suspicion that this is "older" functionality - what I can find on the web implies that task manager functionality has improved since Windows NT.

Is schtasks.exe simply a command line tool written on top of the ITaskManager COM interface? Or are there things that schtasks.exe can do that the ITaskManager interface does not?

Does the ITaskManager interface/COM component generate ".job" files in the Scheduled tasks folder?


The new Task Scheduler 2.0 was introduced in Windows Vista, and you use the ITaskService interface to access it. I believe Schtasks.exe is built upon that API.

The TS 1.0 ITaskScheduler APIs still work though, for backward compatibility. So which one to use depend on which operating system versions you need to target and if you need the new features of TS 2.0.


I am having some success using this library: <a href="http://www.codeproject.com/KB/cs/tsnewlib.aspx" rel="nofollow">http://www.codeproject.com/KB/cs/tsnewlib.aspx</a>

It appears to use the ITaskScheduler COM interface internally and exposes the functionality that I need.

Thanks Mattias for your quick answer too (upvoted).


  • App name already exists in iTunes Connect
  • SQL select column when there's more than one of the same name
  • CSS Background to stretch to window bottom?
  • AngularJs path not changing, even after apply
  • Using a promise for retrieving data inside angular directive
  • How to listen for a site-wide event in a directive with isolate scope
  • Matching only the beginning anchor of a multiline string
  • How to fit image height to juxtaposed text height
  • IntelliJ IDEA 15 Scene Builder not showing all controls
  • HTML5 Video causes weird glitch in CSS :hover transition, doesn't work well cross-browser
  • In a Django template, how to specify a dictionary key which is itself an attribute?
  • How do I specify “Run with highest privileges” in VBScript?
  • Child divs height isn't the same as parent div
  • Transparent Background and No Buttons When Customizing Content of an AlertDialog on onPrepareDialog
  • How to focus on a particular portion of an another html page when click on a button or link
  • Display informations about a bubble chart D3.js in AngularJS
  • End UNWIND statement in a Cypher Query
  • Optional spaces and multiple alternatives in wl-pprint-extras
  • Enterprise Architect - Cancel Connectors Bridges
  • How to remove last utf8 char of a python string
  • Firefox extension testing and developing - I'm confused
  • Time taken for Hadoop job to execute
  • Manually Timing out a C# Thread
  • Symfony 2 error page response
  • Which open source license has no forking [closed]
  • netsh acl setting (need alternative method - registry settings?)
  • How to explicitly/implicitly implemented interface members in C++/CLI?
  • aapt.exe'' finished with non-zero exit value 1
  • Bigquery event streaming and table creation
  • Cannot upload to OneDrive using the new SDK
  • Tamper-proof configuration files in .NET?
  • Code in Job's Script Block after Start-Process Does not Execute
  • Change Inet root folder for iis 7
  • How can I send an e-mail from a vbs script
  • Running a C# exe file
  • Javascript + PHP Encryption with pidCrypt
  • WOWZA + RTMP + HTML5 Playback?
  • Is there a mandatory requirement to switch app.yaml?
  • How does Linux kernel interrupt the application?
  • UserPrincipal.Current returns apppool on IIS