Page 1 of 1

Check for the presence of a scheduled task

Published: November 12, 2024 - 5:03 PM
by jlatieule
Good evening,


I'm using schtasks to perform a DELETE operation, but I don't know how to verify if the task to be deleted actually exists.
If I run the deletion and the task has already been deleted, the package correctly throws an error.

How can I check for the presence of a scheduled task with wapt?

Re: Checking for the presence of a scheduled task

Published: November 12, 2024 - 5:59 PM
by dcardon
Hello Joel,

There's the `task_exists` function which returns whether the item exists or not (you need the full path if there's a directory). For example:

Code: Select all

setuphelpers.task_exists(r'TVT\tvsuupdatetask')
Note: the function launches a simple schtasks /query

Sincerely,

Denis

Re: Checking for the presence of a scheduled task

Published: November 13, 2024 - 2:53 PM
by jlatieule
Thanks Denis,


it works perfectly for me.