Auto run SFC and DSIM maintenance on windows update failure

Is it possible to have a recovery action, if Windows Update (Beta) fails to install other than “reboot required and reboot preference was set to suppress” to automatically run sfc and dism scans then try again?

or have an option in deployments for a recovery action box where we can add our own scripts to run in the event a failed result is returned? if this is the option than it would be good to have it on all deployments including global ones.

SFC and DISM are a good post-update practice, but they don’t offer a lot of effectiveness prior to installing an update. You’d be better served clearing “C:\Windows\SoftwareDistribution”, re-registering DLLs, among other things. A task already exists for that, called “Clear/Repair Windows Update Cache Task (Beta)”.

It would be nice if, when Install Windows Updates fails, it produced a child task to clear the update cache and try again. However, there’s only a certain number of passes it should be allowed before someone should step in. Not a great idea to have it repeatedly trying overnight. So I can imagine the scripting gets a little intense trying to find a balance.

That being said, for other uses, I agree it would be nice to have SFC and DISM ready to run on the fly.