akshay karambale
Posts: 49
Joined: Thu May 28, 2020 8:04 am

Deleting of Environment variable while installing Bootstrapper EXE

Hi,
We have one MSI package and whenever we are installing it with the command line and passing LICENSE_SERVER as an argument with its value it creates one system environment variable with the value which we are passing with that argument.
We have created one Bootstrapper EXE package in which we have added that MSI package under pre-requisite and also created the install parameter named LICENSE_SERVER with default value as white space (" ") because advanced installer not going to create install parameter without value. And also we have added command LICENSE_SERVER="LICENSE_SERVER" in the command line of that prerequisite. Which acts as a command-line argument to that MSI package.
Whenever we are installing our bootstrapper exe with the command line bypassing that LICENSE_SERVER as an argument it is passing that argument to the MSI and that MSI adds the environment variable as per our requirement.
But we have faced one problem, I have explained it by using use cases below,

Case 1. Command-line installation of Bootstrapper on a fresh machine.
1. Execute command:- bootstrapper.exe LICENSE_SERVER="PTPL-104" /qn
2. It installs both bootstrapper.exe and MSI and creates that environment variable in the system. It should always create or update that environment variable from the system.
3. It is working fine for us.

Case 2. Uninstall the Bootstrapper.exe and MSI.
1. It should not remove the environment variable that we have added.
2. It is working fine for us.

Case 3. Install the Bootstrapper.exe using UI. (environment variable should be present in the system)
1. It should not remove that environment variable from the system which is already present in the registry editor system.
2. Which is a problem for us, It should not add or delete when we are installing it using UI.
currently, if we are installing our Bootstrapper through UI, it deletes that environment variable.

So please help us to achieve this use case 3 requirement,
We have added some screenshots of our Bootstrappers AIP project for your reference.
Bootstrapper should not add or delete an environment variable while installing it using UI.
We are waiting for your reply,

Thanks
Akshay
Attachments
Commandlinepage.JPG
Commandlinepage.JPG (29.08 KiB) Viewed 12177 times
InstallPara.jpg
InstallPara.jpg (61.39 KiB) Viewed 12177 times
Dan
Posts: 4513
Joined: Wed Apr 24, 2013 3:51 pm

Re: Deleting of Environment variable while installing Bootstrapper EXE

Hello,

You can condition the enviromnet variable creation based on the UILevel property.

Since the enviromnet variable does not allow conditional creation, we will use the componnet that the enviromnet variable attaches. We will create a dummy registry to have a new componnet created and the same component will be used by the enviromnet variable.

1) Create a registry key
dummy registry.PNG
dummy registry.PNG (56.83 KiB) Viewed 12157 times

2) Condition the component installation based on the UILevel property value:

Code: Select all

UILevel = "2"
component properties.PNG
component properties.PNG (36.35 KiB) Viewed 12157 times

3) Select the dumy component to be used by the environment variable:
environment properties.PNG
environment properties.PNG (40.77 KiB) Viewed 12157 times

So, when installing silently, the setup will set the UILevel property with 2. Because the condition of the component will be true, the enviroment variable will be created.
When installing with UI, the UILevel property will have a different value than 2, which makes the condition of the component to be false. A false componnet condition will prevent the enviroment variable to be created on the target machine.

Let me know if you have other questions.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”