The code posted by dahall works fine. To see the option as "selected", you have to reload Task Scheduler window by pressing F5. Switching from an activity row to another, the window keep showing the old settings...
Sorry for the late response! :) Bye!