akshayk
Posts: 1
Joined: Thu May 26, 2022 11:23 am

How to save MSI property value and use that value while Uninstalling that same executable

Hi,
Greetings of the Day!
Actually, we have one requirement using the advanced installer executable. For that, I have created one executable using the advanced installer.

I have explained my requirement below.
I have to pass one parameter to my executable using the command line and create an ADMIN_SETTINGS environment variable with the value of the parameter that I have passed to it.
Which I have achieved till yet. To achieve this, I have created one MSI property and assigned that MSI property as a value to my environment variable.
but my actual requirement, which I have explained using use cases below,

Case 1: Command-line installation

1.1 Installation on a fresh machine (where the ADMIN_SETTINGS variable does not exist)
While installing the executable using the command line, if we pass the ADMIN_SETTINGS parameter, then it should add the AKSHAY_ADMIN_SETTINGS system environment. : - Done
1.2 Installation on an old machine (where the ADMIN_SETTINGS variable already exists)
While installing the executable using the command line, if we pass the ADMIN_SETTINGS parameter, then it should update the new value of the AKSHAY_ADMIN_SETTINGS system environment (provided the new value and the old value are different, otherwise, it will keep them the same.
1.3 Installation without specifying ADMIN_SETTINGS parameter
It should not add, update, or remove this system environment variable.

Case 2 : UI installation means starting the executable from the Windows UI (without any options).

While installing the bootstrapper using UI, it should not add, update, or remove this system environment variable.
Case 3 : Command line/UI Uninstall
If the executable has set the environment variable during installation, it should be removed only if the value is unchanged from when it was set at installation.

If the value already existed prior to the installation, then it remains unchanged.


How to save MSI property value and use that value while uninstalling (which is required for case 3)

So, please help me out to resolve this problem.
If you give some references, it will be really helpful for me.

Thanks in advance,
Akshay
Eusebiu
Posts: 4931
Joined: Wed Nov 14, 2012 2:04 pm

Re: How to save MSI property value and use that value while Uninstalling that same executable

Hi Akshay,

In order to be able to use, during the uninstallation, the value of a property that was set during the installation, you can go in the "Properties" page and select the "Set persistent property" option for that property.

Let me know if that helped.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”