Skip to main content

We’d like to automate Windows reboots, but we can’t until we can find a way to perform some actions before a reboot. For example, when rebooting a web server it would be nice to notify the load balancer to take the web server out of the pool. While there are some Windows “shutdown” events we can monitor for the problem with them is they typically come after the shutdown process has started.



It would be great if we could get a notification (on the machine being rebooted) right before Automox is going to start the reboot process. For example just check for a well known program name and if it’s there call it, if not no harm, and if we want to use this exit point we’ll put a program there.



Or what other ways have people found to perform pre-shutdown operations on Windows boxes?

Could this be done with a worklet (custom policy) that does the pre-shutdown tasks and then issues a reboot in the powershell script?






Let me know if that sounds feasible for your use case. I’ll also ask the support folks here for some suggestions and ideas.


One caveat from support - this approach would work provided the commands you need (for instance notifying the load balancer) don’t require network authentication. That would require embedding credentials in the worklet, which we don’t recommend for security reasons.


What I’m not clear on here is how does that custom policy either do the patching, or get triggered from the patch policy?



The solution I’m looking for would be to allow Automox to patch the servers (as we do now) but then also allow Automox to automatically reboot* the servers at the end of the patching process. I can’t do that last step if I can’t do some pre-shutdown actions before the reboot. Am I missing a link between the patching and the reboot worklet?



-W



* We’ll leaving choreographing multi-server reboot for another issue. 🙂


I was thinking you’d do the patching as normal, but without the reboot (set automatic reboot to no). Then once the patches have gone through you’d run the worklet policy to do the pre-reboot tasks and kick off the reboot. We don’t (yet) have a way to fully automate this end to end, but you could schedule the patches on a particular day, and then the tasks/reboot run later that day or the next. Would that work?


Yes and no. I guess that would work, but there’s no coordination between when a patch is applied and the reboot occurs – the reboot might be pointless if there’s no reboot requirement. But I think I can get the reboot requirement out of Windows.



Though at that point I’ll probably just schedule a local job in the Windows job scheduler to do the reboot. Without integration between the patch apply and the reboot there’s really no reason to use Automox for the reboot handling. When/if you get integration between the two then there’s added value to let Automox do the reboot. But you’d pointed me in a useful direction, thanks.



-W


That makes sense. Once we have a way to make policies conditional on each other completing then we’d be able to do what you’re wanting within Automox.



We have a feature request page setup here, for features that are under consideration. You can vote for ones you want us to tackle sooner, and suggest your own. This one probably covers your use case so you can vote for it here:





Perfect. Done! 🙂