Search code examples
c#windowsinstallationwindows-installer

How to find out if an MSI I just installed requested a Windows reboot?


I've built a setup.exe in C# that runs several chained MSI's (with the /QUIET /NORESTART). At the end I'd like to check if a reboot is needed in the machine (that is, if one of the MSI's requested a reboot).

How can I detect so?


Solution

  • The following registry location has the information:

    Key HKLM\System\CurrentControlSet\Control\Session Manager, value PendingFileRenameOperations

    Source: https://learn.microsoft.com/en-us/sysinternals/downloads/pendmoves