How can I retrieve the value of a MSI property on the time of Uninstallation?

2.2k views Asked by At

I have an Installer for an application, which I use some customactions in that. At the time of installation I have been using some Custom MSI properties like DBHOST etc. to determine the database host.

And the default value for this is localhost.

But I have been setting this DBHOST property with some other value (like 192.168.1.3) through the commandline at the time of installation. and the installation worked properly with the property set through the commandline.

But When I used the

    MsiGetProperty

function in a customation that has to be executed during the uninstallation time, I got the default value (localhost) instead of the value that i have set through commandline while installation (192.168.1.3)

Can Any one help me in this.? why this happened.? Is it needed to do anything else to get the same value for the MSI property at the time of uninstallation?

Thanks In Advance...

2

There are 2 answers

4
Bogdan Mitrache On BEST ANSWER

A property value is not persistent, this means that on uninstall it will not remember the last value it had during the install and it will use its default one. The best and easier solution is to write this value in a registry entry and retrieve it during the uninstall using a registry search.

1
Christopher Painter On

Since you mention DBHOST, if you use InstallShield's native SQL Scripts capability, they have prewritten custom actions in their infrastructure to persist the properties needed by the SQL connection for subsequent use during repairs, minor upgrades and uninstalls.

The default property name is IS_SQLSERVER_SERVER.

BTW, DBHOST is pretty innocent, but realize some persisted data ( such as IS_SQLSERVER_USERNAME and IS_SQLSERVER_PASSWORD ) is sensitive and needs to be encrypted, decrypted. InstallShield does this automatically. Whether the security is strong enough for your needs is up to you to review.