2

I successfully created task in Task Scheduler. I know how to disable it but I cannot find a way completely remove it

1 Answers1

3

Sorry for being late... I just fought with this issue. Firstly i learn how to create a task using this this good snippet from xuhcc on another question... After i searched for about 40 minutes on Microsoft`s site, i just got it and it works.

Here is a little part of my code:

def deleteWindowsTask(updatetask_id):
    obj = UpdateTask.objects.get(pk=updatetask_id)

    scheduler = win32com.client.Dispatch('Schedule.Service')
    scheduler.Connect()
    root_folder = scheduler.GetFolder('\\')

    root_folder.DeleteTask(obj.task_name,0) 
...

basicaly everything here is a Task Scheduler scripting object and you can modify them by using the following link.

in my case the "root_folder" in the language of "Task Scheduler scripting object" is the TaskFolder object as you can see here.