Windows – Stop automatic reboot with gpedit shutdown script in Windows 2k8

automationpowershellshutdownwindows

I am search for a way to validate and maybe stop an automatic reboot under windows.
E.g. automatic reboot is initialized by windows update.

When adding a shutdown script with gpedit this script gets executed correctly but what can I do when those scripts are more complicated?

My case is the following: before I reboot a server, I need to gracefully shutdown the installed application and I have to wait because the application shutdown can take up to an hour.
So I have to validate within the shutdown script if everything was executed successfully and the application was shut down correctly.
I cannot find a way to stop the reboot from within those shutdown scripts.

Does someone have an idea how to establish this?

Short:
Stop reboot from (e.g.) gpedit shutdown script. A similar way would be also OK. Scripting the windows update calls is not really a way to go for me.. 🙁

Best Answer

Maybe you can use this .Cmd script:

Shutdown.exe -a
TaskKill.exe /im <your_app>
Timeout /T <99999seconds_so_your_app_shuts_down_cleanly>
Shutdown.exe /s /t <x_seconds>

Hope it helps.