It can happen that a task that runs as scheduled task simply does not terminate. Whether this is a fault of task manager or the script is unknown, but both can be at fault here. For example, if the batch file contains a pause statement, the batchfile expects a keypress to continue. The task scheduler will never send it, and this the script never finishes.
That being said, I've seen occasions where a task finishes normally, yet task scheduler does not recognize this to be the case. The script terminates normally, yet task manager claims its still running.
For this reason, Microsoft enabled the option to terminate a task after x hours if its still running.
So what you want to do is edit the task, go to the settings tab and find the
Stop the task if it runs longer than 3 days and change this to 1 hour.
At the bottom, you will find:
If the task is already running, the following applies: Do not start a new intstance.
Change this to
Run a new instance in parallel.
Notice that this option has the ability to kill the previous task or queue. I deliberately choose not to utilize this method.
Now, once you save the settings, right click the task and choose
stop to stop the running instance.
Keep in mind, if the script really is at fault here, it may be the case that it does not run normally and thus whatever it is supposed to do never is being done. For example, if you run your script without task scheduler and it works, and does some stuff on network shares, and now you configure to do this with task scheduler, but you run it with higher privileges, it may simply not have access to the network shares and fails for that reason. That should however terminate the script normally though.