Notification for script failing twice

Hi.
We have many scripts doing maintenance or synchronization stuff scheduled to run daily. Some of them sometimes fail due to temporary network problems etc and it’s normally not a problem if they do that one day, but worth investigating if it happens two days in a row.

I’m thinking I should tweak the script sending out mail warnings so that it ignores these failures the first day, but send it if it happens again. I’m thinking I need to pull up the job history and check the last execution.

Just checking, before I start doing this: Are there any ready solutions for this? Anyone else already done a script for this?

Product: PowerShell Universal
Version: 4.2.13