How do I reference the Reboot Pending Property in Burn (WiX)

淺唱寂寞╮ 提交于 2019-11-29 07:32:02

Burn doesn't use MSI's MsiSystemRebootPending because it operates outside an installation transaction. So Burn uses ISystemInformation::RebootRequired instead. There's no guarantee that MSI and ISystemInformation::RebootRequired have the same idea about whether a reboot is required, since MSI doesn't document with MsiSystemRebootPending reflects.

For some general ideas see tool WhyReboot. Here is what it does:

Examines documented registry locations for post-reboot file copy/rename/delete operations.

Examines documented registy locations for "Run Once" applications: these will run once on the next reboot, and are probably used by an installer to perform post-reboot file cleanup and other operations such as registry manipulation.

Examines Wininit.ini on Win9x/ME platforms for pending file rename/delete operations.

ISystemInformation::RebootRequired: Somebody asked for some sample code to call ISystemInformation::RebootRequired mentioned in Arnson's answer.

Here is one blurb - not exactly great, but maybe give it a try:

Set autoupdate = CreateObject("Microsoft.Update.AutoUpdate")
autoupdate.Pause()
MsgBox Err.Number & " " & Err.Description

Set sys = CreateObject("Microsoft.Update.SystemInfo")
MsgBox sys.RebootRequired

' autoupdate.Resume() ' Enable to resume AutoUpdate
Set sys = Nothing
Set autoupdate = Nothing

Maybe just use the latter part:

Set sys = CreateObject("Microsoft.Update.SystemInfo")
MsgBox sys.RebootRequired
Set sys = Nothing

I am not really familiar with the Windows Update Agent Object Model.


Reboots: There are many registry locations that can be involved in triggering a reboot (warning). Get-PendingReboot-Query. And a similar PowerShell script.

Here are some registry locations I have found that are involved in Windows rebooting (definitely not exhaustive):

  • HKLM\SOFTWARE\Microsoft\Updates : UpdateExeVolatile
  • HKLM\SYSTEM\CurrentControlSet\Control\Session Manager : PendingFileRenameOperations
  • HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer : InProgress
  • HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing : RebootPending
  • HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update : RebootRequired
  • HKLM\SYSTEM\Setup : SystemSetupInProgress

And computer rename operation in progress:

  • HKLM\SYSTEM\CurrentControlSet\Control\ComputerName\ActiveComputerName : ComputerName
  • HKLM\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName : ComputerName

CCMClientSDK: And then there are some WMI calls to check for SCCM 2012 Client Reboot Pending Status. CCMClientSDK.IsHardRebootPending and CCMClientSDK.RebootPending. Check the Get-PendingReboot-Query script.

I don't know if it helps but it says here that RebootPending value

will reflect the reboot status of the system when the variable is first requested

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!