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

前端 未结 3 1699
别跟我提以往
别跟我提以往 2020-12-18 00:53

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

3条回答
  •  鱼传尺愫
    2020-12-18 01:02

    To complement Vinko Vrsalovic's helfpul answer with a PowerShell command:

    $rebootPending = $null -ne 
      (Get-ItemProperty 'HKLM:\System\CurrentControlSet\Control\Session Manager').PendingFileRenameOperations
    

    Note that $rebootPending equalling $true indicates that a system reboot is pending for any reason, not just due to MSI-based installations.

提交回复
热议问题