2

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.. :(

  • 5
    Why not configure Windows Update to download and notify for install? That way you could control the installation of updates and control the shutdown of your application when installing updates. – joeqwerty Jan 12 '15 at 3:36
  • I don't know if this would work, but could you try using shutdown.exe's -a (abort) parameter in your shutdown script? Then you could issue a new Restart-Computer once your app has finished shutting down. – jbsmith Jan 12 '15 at 15:18
  • Can you please display the relevant portions of your shutdown script? – Colyn1337 Jan 12 '15 at 16:28
-1

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.

  • Hm. I see its downvoted, but I wonder why? – Tim Lovell-Smith Aug 29 '18 at 17:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.