C# – How to a required reboot be detected for Windows 7

crebootrequiredwindowswindows 7

I am working on a project where several software and drivers are installed on a windows 7 PC. This shall work without user inputs.

Now there is the question: How can I determine in this program if a reboot is required to finish an installation (can be driver or software).

We are working on Windows 7 embedded and there is no taskbar enabled or any tooltips or something like this visible. Software is installed in silent mode.

Best Answer

Use the following registry key:

HKLM\System\CurrentControlSet\Control\Session Manager\PendingFileRenameOperations

Source: How to find out if an MSI I just installed requested a windows reboot?

As discovered by the asker of this question HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootPending shows when a reboot is pending on the machine as long as the OS is Vista or newer.