Environment variables across tasks
Wondering whether environment variables set in one task will persist across subsequent tasks?
I'm thinking of creating a task at the start of some packages that set some environment variables based on the hostname of the machine being installed to - and then use those variables in the parameters string of the installation (for example for defining license server names, serial numbers, etc for MapInfo).
E.g. in the first task have a series of IF statements -
IF %COMPUTERNAME%=Computer1 SET MySerial=12345678
IF %COMPUTERNAME%=Computer2 SET MySerial=87654321
Then in a subsequent task, enter %MySerial% into the parameters of the installer where one would normally enter the serial number.
Of course still need to test that the various installers can take environment variables in the parameters - but first step is whether or not the concept itself is doable.
Comments
I haven't tried setting a variable that way via PDQ yet so I don't know for sure, but I wonder if it would be in scope for your subsequent task.
You could also set a REG variable and store your serial number in your own registry entry, or create a txt file on the local file system containing whatever you need. Then you wouldn't have to worry about scope.
Brad, can you provide more information on using a text file. We considering doing just that to automate our product deployments. Jenkins can trigger PDQ just fine and we would like to be able to specify the version of the product we want deployed in a variable - we don't want to have to modify PDQ every time we release a new version... We can't do it via command line to PDQ (at least not yet), but I have to believe we can write a file - ship that to the PDQ system and have PDQ read that as the first step of the package and then store the contents as variables somehow... Suggestions?