r/PowerShell • • May 16 '26

Question Watching for a script to stall

I have a powershell job that kicks off via task schedular at 9:30 AM, and depending on the jobs it monitors determines when later that evening it should stop. However, somedays, it chokes and stalls.

How would I watch for this stall to occur, and restart the task schedular job. My initial thought would be to use a 2nd task job that fires every 15 mins and watches for the last write time on the transcript.

If you all have a better idea, I would love to know it.

thanks, RogueIT

2 Upvotes

9 comments sorted by

View all comments

Show parent comment

6

u/lan-shark May 16 '26

Invoke-WebRequest offers both -ConnectionTimeoutSeconds and -OperationTimeoutSeconds