I know that if you go through the pending updates, there's a flag (rebootrequired, or similar) that will tell you if a reboot is mandatory, not required, or may be required. It seems that in the metadata of a lot of updates, this is tagged as "maybe, not sure", so there's not a sure fire way to know if an update will cause a reboot.
Given the Microsoft.Update.Session API, is there a way to check through the update content to see if the code itself will change the registry setting HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired
to make windows knows it needs to reboot?
I'm assuming that, even though the metadata is "maybe", there's something in each update that forces this registry flag to to "Ping! I need to reboot!"
Either that, or is there a more reliable way to work out how check which updates require rebooting?
The reason it says "maybe" is because it truly depends and is unique from situation to situation.
Windows Installer may prompt for a reboot if it installs over a file that is in use or the package explicitly requests that the installer reboot. It is easy to determine if Windows Installer prompts for a reboot because it installed over a file that is in use. The first step is to generate a verbose log file. In the verbose log file, look for the presence of the ReplacedInUseFiles property in the property dump. If this property is present with a value of 1, then the Installer will require a reboot because it overwrote an in-use file.