【问题标题】:How do I reference the Reboot Pending Property in Burn (WiX)如何在 Burn (WiX) 中引用 Reboot Pending 属性
【发布时间】:2012-06-08 04:01:06
【问题描述】:

如何在 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 更新刚刚完成更新并需要重新启动。

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

得知 Burn 中的 RebootPending 属性可能与 Windows Installer 使用的属性不完全对应,我还能如何确保我的应用程序在重新启动挂起时不会尝试安装?

【问题讨论】:

    标签: wix windows-installer wix3.6 burn


    【解决方案1】:

    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
    

    我对@9​​87654322@不是很熟悉。


    重启:触发重启(警告)可能涉及许多注册表位置。 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

    【讨论】:

      【解决方案2】:

      有关一些一般性的想法,请参阅工具 WhyReboot。它的作用如下:

      检查记录的注册表位置以进行重启后文件复制/重命名/删除操作。

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

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

      【讨论】:

        【解决方案3】:

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

        【讨论】:

        • 事实证明 ISystemInformation::RebootRequired 和 MSI 的 MsiSystemRebootPending 确实返回了不同的结果。
        • @Randolph:迟到总比没有好。 I have added a sample below。以防万一其他人需要它。我在看其他一些重启的东西,发现了这个。 Manas:是的,我也注意到了这一点,并试图找出一些细节——但 Windows 的方式是神秘的。 PendingFileRenameOperationsMsiSystemRebootPending 设置为 1,但不影响例如 ISystemInformation.RebootRequired。 Arnson - 简洁大师:-) - 这是一个愚蠢的小脚本,但它可以完成工作吗? (不熟悉这个对象模型)。
        【解决方案4】:

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

        将在第一次请求变量时反映系统的重新启动状态

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多