How to change the installation directory for msi dynamically
Hi Folks,
I'm new to WPS. My requirement is like this. I have an .msi. I should change the INSTALLDIR to C:\test on desktops and to D:\test on servers. So I have registered one enviornment system variable like SoftDir=C:\test in desktops and SoftDir=D:\test in servers. So i want to set the INSTALLDIR in tables of WPS according to this SoftDir. Is there any way in WPS or ORCA to set the variable for ex: set sample=HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\SoftDir(key)……sample should fetch the value of softdir key (C:\test or D:\test) in the registry....So that i can use sample in place of INSTALLDIRECTORY......Hope you understand my problem. Appreciate your help. Thanking you.
I'm new to WPS. My requirement is like this. I have an .msi. I should change the INSTALLDIR to C:\test on desktops and to D:\test on servers. So I have registered one enviornment system variable like SoftDir=C:\test in desktops and SoftDir=D:\test in servers. So i want to set the INSTALLDIR in tables of WPS according to this SoftDir. Is there any way in WPS or ORCA to set the variable for ex: set sample=HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\SoftDir(key)……sample should fetch the value of softdir key (C:\test or D:\test) in the registry....So that i can use sample in place of INSTALLDIRECTORY......Hope you understand my problem. Appreciate your help. Thanking you.
0 Comments
[ + ] Show comments
Answers (3)
Please log in to answer
Posted by:
MSIPackager
13 years ago
Well I guess you could do it that way if you wanted - seems rather over-engineered and having to create environment variables on all workstations and servers (in my opinion) is messy. Better to keep everything internal to the MSI - there are a couple of easy options for starters:
1) If you need to keep a single MSI for both environments (or don't want a seperate transform / command line for servers) there is a standard property MsiNTProductType which you can use to detect the OS type then you could set the INSTALLDIR value accordingly or
2) Assuming the standard INSTALLDIR path is already C:\Test - you could just create an MST for the server installations which sets the INSTALLDIR to D:\Test
Your way is possible but you'd have fiddle around a lot more to get it working - the above 2 options are straight forward and you won't need to do anything outside of the package.
Hope this helps,
Rob.
1) If you need to keep a single MSI for both environments (or don't want a seperate transform / command line for servers) there is a standard property MsiNTProductType which you can use to detect the OS type then you could set the INSTALLDIR value accordingly or
2) Assuming the standard INSTALLDIR path is already C:\Test - you could just create an MST for the server installations which sets the INSTALLDIR to D:\Test
Your way is possible but you'd have fiddle around a lot more to get it working - the above 2 options are straight forward and you won't need to do anything outside of the package.
Hope this helps,
Rob.
Posted by:
sridhar22_85
13 years ago
Posted by:
MSIPackager
13 years ago
Easiest solution is to create a server specific transform, add and entry in the property table INSTALLDIR = D:\Test (or E:\Test) and install via the following command line:
msiexec /i your.msi transforms=yourtransformname.mst /qb (or whatever switched you require)
You will get a validation error in the MST but don't worry about it.
Cheers,
Rob.
msiexec /i your.msi transforms=yourtransformname.mst /qb (or whatever switched you require)
You will get a validation error in the MST but don't worry about it.
Cheers,
Rob.

so that the conversation will remain readable.