As part of a virtual session maintenance tool I am working on, I need to reliably detect when an OS needs a reboot to get itself into a stable state. There are many causes for why a reboot may be needed, and there seems to be many ways to detect whether a reboot is required. Here is what I got so far:
- There are items listed at HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\PendingFileRename
- There are items listed at HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce
- There are items listed at HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx
- There are items listed at HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunOnce
- There are kernel services to be started or filterdrivers to be unloaded (according to AngelD here: http://www.appdeploy...tm.asp?m=39450). Apparently no way to detect this unless the appropriate flags have been raised by whatever installed the services / drivers.
It seems to me that there is a genuine need for a comprehensive "IsRebootReallyNeeded" function that can be used to detect as many of these cases as possible. I can't believe that this hasn't been written a million times before, hence this post...
I am also sure there are other cases when a reboot is needed which is not covered by the above list. Can u think of any such cases? For one thing the newest patches from Microsoft seem to trigger a reboot timer. Any idea where the info for this is stored?