PDA

View Full Version : Silent Uninstall requiring reboot



MarkDynna
12-27-2018, 10:36 AM
During an update to a new version, our installer uninstalls any previous version found on the machine. We want to do this silently since we don't want the user to have the option not to uninstall the previous version or anything. To do this we pass the "/S" switch to the uninstall program. What we have found is that the uninstall sometimes produces a pending file deletion operation that is then completed the next time the computer is rebooted. Is there some flag or return code that can be checked after the Uninstall program runs to determine if one of these pending operations has been queued?

linder
12-27-2018, 12:05 PM
Hi Mark,

the uninstall only asks for a reboot if one or more files to be uninstalled are in-use (locked) during the uninstallation process.

You have several different options. What about the following: you can write a custom uninstall to have full control over the uninstallation process. Then, at the end of your custom uninstall, check the reboot status of the uninstaller (Get System Info -> Reboot Status; a return code of "1" means that a reboot is required) and write it to a specific location. Then read the value from your installer (after the call to the uninstall operation).

Or use the "Get Pending File Operations..." script function from your setup.exe before and after the uninstall process. This should tell you if a new file deletion operation is pending.

Does this help?

Friedrich

linder
12-27-2018, 12:19 PM
And I have more options available to handle this. If you need help or a demo project, just let me know.

Friedrich

MarkDynna
12-27-2018, 03:02 PM
Ok, so if "Get Pending file Operations" is greater than 0 after the Uninstall, then some file(s) are pending deletion?

linder
12-28-2018, 10:33 AM
Hi Mark,

if the function succeeds, the %_SB_ERRORCODE% return value is nonzero and contains the number of found items. If you check this before running the uninstall and it returns a value >0 then the pending file operations are from another install / uninstall.

BTW, I have another idea on how to handle your scenario. If you are interested, I can develop and upload a quick demo.

Friedrich

MarkDynna
12-28-2018, 10:55 AM
Sure you can show me your other idea as well.