如何在Burn(WiX)中引用重启Pending属性

时间:2012-06-04 00:52:53

标签: wix windows-installer wix3.6 burn

如何在Burn(WiX)引导程序中引用RebootPending属性? 我知道属性名称是RebootPending,它实际上引用了Windows Installer中的MsiSystemRebootPending属性。

我正在尝试这样的事情:

<bal:Condition Message="There is a restart pending. Please restart your computer before  attempting to install !(loc.ProductName).">RebootPending = 0</bal:Condition>

但即使Windows Update刚刚完成更新并需要重新启动,它也始终如此。

我的语法错了吗?我的病情应该改为[RebootPending]吗?

在被告知Burn中的RebootPending属性可能与Windows Installer使用的属性不完全对应时,我还能确保我的应用程序在重启未决时不会尝试安装吗?

4 个答案:

答案 0 :(得分:5)

Burn不使用MSI的MsiSystemRebootPending,因为它在安装事务之外运行。所以Burn使用ISystemInformation::RebootRequired代替。无法保证MSI和ISystemInformation :: RebootRequired对是否需要重新启动有相同的想法,因为MSI没有带有MsiSystemRebootPending的文档反映。

答案 1 :(得分:2)

对于一些一般性提示,请参阅工具WhyReboot。这是它的作用:

  

检查重新启动后文件复制/重命名/删除操作的文档注册表位置。

     

检查“运行一次”应用程序的文档注册位置:   这些将在下次重新启动时运行一次,并且可能由一个人使用   安装程序执行重新启动后文件清理和其他操作   例如注册表操作。

     

在Win9x / ME平台上检查待处理文件的Wininit.ini   重命名/删除操作。

答案 2 :(得分:2)

ISystemInformation :: RebootRequired :有人要求提供一些示例代码来调用Arnson答案中提到的ISystemInformation::RebootRequired

这是一个模糊 - 不是很好,但也许尝试一下:

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

也许只使用后一部分:

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

我对the Windows Update Agent Object Model并不熟悉。

重新启动 :触发重启(警告)可能涉及许多注册表位置。 Get-PendingReboot-Query。并a similar PowerShell script

以下是我发现的一些与Windows重启有关的注册表位置(绝对不是详尽无遗):

  • 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

计算机重命名正在进行的操作:

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

CCMClientSDK:然后有一些WMI调用来检查SCCM 2012 Client Reboot Pending StatusCCMClientSDK.IsHardRebootPendingCCMClientSDK.RebootPending。查看Get-PendingReboot-Query script

答案 3 :(得分:0)

我不知道它是否有帮助,但它说here表示RebootPending值

  

将反映首次请求变量时系统的重启状态

相关问题