July 11, 2014 at 1:02 am #17006
I am trying to install a .exe setup package using the Package resource.
The .exe uses an environment variable during the installation and the environment variable has been set in the server image so it's already set.
The installation won't pick up the environment variable though.
If I run the same installation from the command prompt, it works just fine.
I also tried adding an Environment Resource to set the variable but I get the same results.
Does anyone know why the environment variables are not honored?
Perhaps it has something to do with the execution context?
July 11, 2014 at 3:41 am #17007
We'd need some more specific information (which installer, which environment variable, do you have any logs from the installation, etc), but so far, every problem I've seen posted about the DSC Package resource stems from the fact that it winds up being executed as LocalSystem, and many installers don't seem to have been developed or tested with that scenario in mind.
July 11, 2014 at 4:40 am #17009
Thank you for your response.
The software I am trying to install is RabbitMQ and the installation runs fine and the product gets installed but if the environment variable RABBITMQ_BASE is set, certain components should be installed in the directory set as value for the variable.
The installer runs but does not pick up this variable so it uses the default path instead.
The installer is NSIS (Nullsoft Scriptable Install System) and the variable is RABBITMQ_BASE.
I am currently looking for the log files but I haven't been able to find them yet.
July 11, 2014 at 5:34 am #17013
Hmm... looking at the Environment resource now, I have a sneaking suspicion that it won't take effect until the next time a process starts, because the resource is setting the value directly in the registry (and not doing anything else). If this is the case, it would be a simple matter to create a community version of the Environment resource which also sets the variable in the current process's environment. That way, it should take effect right away when later DSC resources are applied.
I'll play around with this at some point, when there's time. In the meantime, I'd recommend investigating whether this installer can take command-line arguments instead of relying on environment variables.
July 11, 2014 at 5:45 am #17014
Again, many thanks for the quick response. 🙂
I did quite a bit of research on the command line parameter but I could not find any way to set this.
I just need to clarify two things here.
1) I have tried to set the environment variable in our server image as well so it has been there for many reboots prior to the installation but that did not work either so it seems like the environment variables are not honored at all.
2) The installation directory is something that I may be able to change but this is a "data" directory so only some files goes in the directory pointed to by the variable.
Since we are evaluating DSC at the moment my real interest in this is really just to know if the environment variables are honored or if this may become a possible issue in the future.
July 11, 2014 at 6:12 am #17016
As far as I know, the only thing special about how DSC launches an installer is the fact that it's done with the System account. If you set the environment variable for the whole machine, then the installer should see that.
You must be logged in to reply to this topic.