I am testing installation scripts and must put Windows into a state that a reboot is pending from another installation. I have read how to test whether a reboot is needed. A proper way to set the need is not clear.
The honest answer: I don't know for sure. There are a lot of different registry locations that indicate that a reboot is necessary. I just tried to make an ad-hoc list here: How do I reference the Reboot Pending Property in Burn (WiX). I am not sure what mechanism uses them all, but some of these reboot entries could conceivably cause further installs to be blocked.
As you know there are certain Windows Updates that manage to schedule reboot prompts that will not cease or go away and not allow further software to be installed (at least not Windows Installers). I am not familiar with the APIs used to trigger this - chances are they are Microsoft's own functions that can only be called by TrustedInstaller (Windows Modules Installer service - used to install Windows Updates- capable of replacing files protected by Windows Resource Protection ). Just a theory. If I get time tomorrow I will have another look.
There are features in group policy to disable Windows Installer by policy, but I would not go down that path if I were you. Group policy is heavy stuff and it won't prevent non-MSI installs (so far as I know). I am sure you have already found this option.
Looking at this script: Get-PendingReboot-Query, the SCCM section seems to indicate what is referred to as a "Hard Reboot" ($CCMClientSDK.IsHardRebootPending
). Maybe something which indicates a reboot that will not allow anything else to be done before the reboot is done? If you have SCCM available this is the option I would investigate. Unfortunately I am not up to speed on the issue. Maybe try your luck on serverfault.com or even superuser.com where system administrators and power users lurk?
I wouldn't advise you to proceed with a reboot automatically. You should better inform the user that before going with the installation, a reboot is needed.
If you want to make sure that after the reboot (any reboot), the installer will be running, you can take advantage of the Run and RunOnce registry keys: https://msdn.microsoft.com/en-us/library/windows/desktop/aa376977(v=vs.85).aspx
Basically, if you detect that a reboot is pending, then create those registry behind and also inform the user that he should reboot first the machine.
After reboot, the installation will be loaded automatically by Windows if you create the registries.
The honest answer: I don't know for sure. There are a lot of different registry locations that indicate that a reboot is necessary. I just tried to make an ad-hoc list here: How do I reference the Reboot Pending Property in Burn (WiX). I am not sure what mechanism uses them all, but some of these reboot entries could conceivably cause further installs to be blocked.
As you know there are certain Windows Updates that manage to schedule reboot prompts that will not cease or go away and not allow further software to be installed (at least not Windows Installers). I am not familiar with the APIs used to trigger this - chances are they are Microsoft's own functions that can only be called by TrustedInstaller (Windows Modules Installer service - used to install Windows Updates- capable of replacing files protected by Windows Resource Protection ). Just a theory. If I get time tomorrow I will have another look.
There are features in group policy to disable Windows Installer by policy, but I would not go down that path if I were you. Group policy is heavy stuff and it won't prevent non-MSI installs (so far as I know). I am sure you have already found this option.
Looking at this script: Get-PendingReboot-Query, the SCCM section seems to indicate what is referred to as a "Hard Reboot" ($CCMClientSDK.IsHardRebootPending
). Maybe something which indicates a reboot that will not allow anything else to be done before the reboot is done? If you have SCCM available this is the option I would investigate. Unfortunately I am not up to speed on the issue. Maybe try your luck on serverfault.com or even superuser.com where system administrators and power users lurk?
You can add an entry in the registry, based on which you can check for reboot. Or perform reboot.
Though I would advise you to avoid reboot, if you can. Windows installer automatically detects if the reboot is required and will indicate the same. Though you can suppress it.
There is a PendingRenameOperations registry, which is set when a reboot is required to do file updates, during an upgrade. In our product, we check for this registry key along with few other product-related registry keys - then display an message to user that reboot is required or not. If reboot is accepted by the user, then install/upgrade is terminated.
Nice article on the same: https://technet.microsoft.com/en-us/library/cc164360(v=exchg.80).aspx
© 2022 - 2024 — McMap. All rights reserved.