Schedule reboots upon action completion

(imported topic written by sinucus)

I’m trying to schedule a reboot of the systems that get patched successfully. The specific issue is that I’m using Baselines to patch and I only want systems that completed successfully to do the reboot. My first attempt was to use the “Post-Action Execution script” tab and run a cmd window to use “at 5:00 shutdown -r”. This works great but it works 100% of the time, even when the Baseline fails. I’m sure if I uncheck the “Run all member actions of action group regardless of errors” then it would work fine but I want all patches to attempt to run despite if one fails.

The next thing I was thinking was that I could query the status/exit code of the action to then run the shutdown command but that didn’t work. I tried, if status of action = “failed” then waithidden cmd.exe /c at 15:05 shutdown /r /t 120 else waithidden cmd.exe /c at 15:06 shutdown /r /t 120

It’s possible that I got the quotes or ( ) wrong but I am unable to test this in the qna so it’s quite difficult to debug.

Does anyone have any experience with this? Thanks

(imported comment written by sinucus)

I just realized that my if then statement looks wrong. I was testing the if then else and I used two different times so that I could see which if triggered. Neither of them fired…