Idea: Stop-PSUScript?

Would it make sense to have a way to kill a running script?

For example, you may have a process that runs n scripts using invoke-psuscript in an orderly fashion. However, you might run into an event where one script is “stuck,” and you must kill it to move on. Maybe a timeout when starting a script?

Thoughts?

1 Like

You mean this, perhaps?

And for stopping any stuck process due to forgetting to set the timeout or error action, if you’ve set the specific script to use anything but the integrated environment, you should be able to kill the process by id that the job is running in.

I understand your view, but I don’t think it’s a solution to a problem that could’ve been prevented from happening in the first place - imho!

Also, forgive me if I don’t understand you correctly…

What keeps you from using the “Stop job” button?

I don’t tend to monitor jobs I guess. We have various APIs that call(s) jobs.

I will give the time-out a shot.

Update: Timeout should work for us. Thanks for pointing out the obvious @ruben. Sometimes I tend to think I have to code everything when the answer is already in front of me.

Happens to me all the time… Glad I could help!