CaMat
Posts: 18
Joined: Wed Jun 22, 2022 11:48 am

Refresh enviroment variable

Hi,

I have a problem with enviroment variable and service, which installer starts during the installation process. For service, an enviroment variable is not set until a computer restart. How can I make that, the added enviroment variable will be available for service during the instalation process?

I tried to refresh enviroment from this post: viewtopic.php?t=37113 and it didn't work.
Also, I tried to add prerequisites with console application which adds an enviroment variable, but after getting to main installation the enviroment variable is empty. In main installation I'm getting an enviroment variable with powershell inline script.
Catalin
Posts: 6661
Joined: Wed Jun 13, 2018 7:49 am

Re: Refresh enviroment variable

Hello,

If the apporach from my colleague's post did not work, then perhaps you can try as it follows:

- create an empty project whose purpose is solely setting the env variable

- add the installer as a prerequisite in your main package and set its "Reboot beahvior" to "Always"

This way, the prerequisite will restart the machine and then when your main installation will start, the env variable should be available.

You can additionally configure the empty project to not be displayed in Control Panel by unchecking the "Register product with Windows Installer" option from the "Product Details" page.

Hope this helps!

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
CaMat
Posts: 18
Joined: Wed Jun 22, 2022 11:48 am

Re: Refresh enviroment variable

Thank you for your response.

Unfortunately, restarting computer is a thing I want to avoid. I hope there is a solution without needed computer restert . But if there is no solution without it, I will try to resolve it with restarting service after installation.
Catalin
Posts: 6661
Joined: Wed Jun 13, 2018 7:49 am

Re: Refresh enviroment variable

Hello,

That is understandable, but I'm afraid I'm not aware of any other solutions beside the one my colleague Dan has offered and the default one of restarting the machine. Even the solution from my colleague Dan, as per my research so far, seems a bit far fetched.

Please let me know if there is anything else I could help you with!

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”