I am trying to write code to automatically "configure" scheduled tasks on a machine. The program will read the XML file, then "configure" the runtime, etc. Tasks based on information in an XML file.
The idea should be that the program can "run" several times on the machine and automatically "add / remove" any effective changes. The way I wanted to do this was as follows:
All tasks will be created using a special "prefix". When a program starts, it “deletes” all tasks with this prefix, since they can be considered to be started by a program with a different, earlier configuration.
Then the program “creates” new tasks.
Therefore, my “configuration” program should be able to
- Get a list of all scheduled tasks on your computer.
- Delete tasks by name
- Creating new tasks by name
It will be easier if I can write a program in C #.
There seem to be two ways to do this:
The C # program explicitly launches the schtasks.exe program with the appropriate command line parameters. It reads and analyzes the output of the schtasks.exe file to get a list of existing tasks so that it can delete them. He then runs the schtasks.exe file to create new tasks.
Use the ITaskManager interface through the .NET COM wrapper to programmatically query and schedule tasks.
№ 2, , " " - , , , Windows NT.
schtasks.exe , COM- ITaskManager? , schtasks.exe ITaskManager?
/ COM ITaskManager ".job" " "?