If you need to prevent IIS elements from being removed during upgrade, here is what you need to do:
- Prevent IIS elements to overwrite the existing website
- Do not remove IIS elements during the uninstall triggered by an upgrade
- the uninstall of the old product version
- the installation of the new product version
- OLDPRODUCTS - this property is set in the upgrading MSI if the package found an older version installed on the target machine
- UPGRADINGPRODUCTCODE - this property is set in the MSI which is being upgraded if the package is uninstalled by a newer version
This can be done through the Condition field from the Website Settings.
2) Do not remove IIS elements during the uninstall triggered by an upgrade
For this, you can go in the Table Editor page (available starting with the Enterprise edition) and condition the AI_IIsUninstall action from the InstallExecuteSequence table.
The condition can be something as this:
Unfortunately during the last uninstall from Control Panel, the IIS element will not be removed. The AdvInst references IIS elements through the ProductCode of the installers. Different versions have different ProductCodes, thus the IIS element will not be removed. For this, a custom action is required.
Code: Select all
( (VersionNT >= 500) AND (REMOVE = "ALL") ) AND ( NOT UPGRADINGPRODUCTCODE )
We recommend to use a PowerShell script code , specific cmdlet being available:
Also, please check the Use the 64-bit script so that 64-bit PowerShell be used on 64-bit machines.
Condition the custom action so that only be executed when the uninstall is not triggered by an upgrade:
Code: Select all
( (VersionNT > 501) OR (VersionNT = 501 AND ServicePackLevel >= 2) ) AND (NOT UPGRADINGPRODUCTCODE )
The sample project is attached to this thread, so if you are interested to take a look directly at my project, you are more than welcome to download the ZIP file.