You can end task from windows task scheduler using below script,(here ‘hibes’ is the running task’s name from windows task scheduler )
import subprocess;
process= subprocess.Popen([‘SchTasks’,’/End’,’/TN’,‘hibes’],shell=True,stdout=subprocess.PIPE);
result=process.communicate()[0]
print result;
sample output would be,
SUCCESS: The scheduled task “hibes” has been terminated successfully.