If you are doing a hardware update from the GUI you have the option to select to upgrade on reboot. What this is doing is looking for a reboot to exectute and then instead it powers it down, upgrades, and powers it up. Is there a way to tie into this so I can use this process for something else. Basically I want it to monitor for a reboot, then power off, run my custom instance, then power back on. This way I can tie an update to a scheduled reboot for patches.
You could create a shutdown script in the guest that first makes a REST call to an Orchestrator workflow that would handle the rest from there, optionally also removing said shutdown script when complete.