I'm using a custom BA with WiX and I'd like to detect if there is a pending reboot to warn my user before they try to install, only to have it fail. How do I reference the Reboot Pending Property in Burn (WiX) That question only showed me what doesn't work, and the OP marked an answer so no one has answered his followup question of, "Having been informed that the RebootPending property inside Burn may not correspond exactly to the property that Windows Installer uses, how else would I ensure that my application does not attempt to install when a reboot is pending?" That is what I'd like to know.
Use the RebootPending
Burn variable like so
Bootstrapper.Engine.StringVariables["RebootPending"];
If it's "1"
then a reboot is pending
Since I'm using a managed installer bootstrapper application I ended up doing this in C# using:
string regLoc = @"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager";
string[] regKey = (string[])Registry.GetValue(regLoc, "PendingFileRenameOperations", new string[]{"DefaultValue"});
Entries in that key are files waiting for a reboot so they can be changed. Although this isn't bulletproof, it gives a likely indicator that the install might fail because of a pending reboot.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With