At the office, when I leave for the night I very rarely log off or reboot. I simply lock my workstation and go home, leaving all my development tools exactly how I left them.
If Windows-Update rolls through and reboots my machine in the middle of the night I'm only slightly peeved because when I log back in the next morning, any MS Office application, or Visual Studio instance I had running will have already automatically restarted, opening whatever file(s)/projects/solutions I may have been working on.
My question is: How can I make my Windows Forms applications (C#) do this? Is there some way for my application to "register" that it wants to be restarted if the system automatically reboots?
To do so through Group Policy, go to Computer Configuration\Administrative Templates\Windows Components\Windows Update and select Turn off auto-restart notifications for update installations.
Select Start > Settings > Windows Update . Select Schedule the restart and choose a time that's convenient for you.
Here's how. Click on Settings > Update & Security > Windows Update. Scroll down and click on Advanced Options. Toggle on Restart the device as soon as possible when a restart is required to install an update.
I think the RegisterApplicationRestart Win32 API function might be what you're after, it's part of the Restart Manager API.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With