I have a Wix Installer, Product.msi, which launches a setup.exe via Custom Action. When I execute my Installer through Command Prompt, for example:
msiexec /i Product.msi /q
or
msiexec /r Product.msi /q
or
msiexec /x Product.msi
I would like to pass /i /r /q /x options to setup.exe
Is it possible to achieve this through Wix Toolset?
The flags you mention all set properties for the MSI, which you can then reference in your custom action, converting to whatever format you need for your setup.exe.
For instance:
/i corresponds to the value of Installed being false (if the product isn't already installed).
/r corresponds to a value of "Repair" on the WixUIInstallMode property.
/x corresponds to a value of "Remove" on the WixUIInstallMode property.
/q (and its modifiers like /qn and /qb) correspond to the UILEVEL property, which has the following values found from this link.
UILevel:
INSTALLUILEVEL_NONE 2 Completely silent installation.
INSTALLUILEVEL_BASIC 3 Simple progress and error handling.
INSTALLUILEVEL_REDUCED 4 Authored UI, wizard dialogs suppressed.
INSTALLUILEVEL_FULL 5 Authored UI with wizards, progress, errors.
You can see this answer if you're unfamiliar with passing values and referencing them in a custom action.
Related
I have an .msi installer that I am trying to automate the installation for. I cannot use the /quiet option for a silent install because I need to provide the installer a license number.
I've been trying to use the SAVEINI parameter to create the response file
msiexec /i "Installer.msi" SAVEINI="response_file"
msiexec /i "Installer.msi" SAVEINI="response_file.ini"
msiexec /i "Installer.msi" SAVEINI="C:/Windows/LTSvc/packages/Installer/response_file"
None of these create the response file the install runs and then no response file is created.
Any help would be greatly appreciated and thank you in advance for your time.
Windows Installer doesn't have the concept of a response file. Instead you pass public properties at the commandline or generate a transform and apply it at install tine.
https://learn.microsoft.com/en-us/windows/win32/msi/about-transforms
So I am trying to run a quite installation, with my msi, and it seems like I can easily pass a number for a parameter that I have, but I can't seem to pass in a string...I tried using single quotes ' and double quotes "
msiexec /i 'My Installer.msi' /quiet JREPATH="c:\\BLA BLA"
This and also the single quotes return this :
Now according to this article : https://learn.microsoft.com/en-us/windows/desktop/msi/command-line-options
it should work...
Property values that are literal strings must be enclosed in quotation
marks. Include any white spaces in the string between the marks.
msiexec /i A:\Example.msi PROPERTY="Embedded White Space"
There is no problem with the MSI, I assume this because if i pass a number..it works...
msiexec /i 'My Installer.msi' /quiet JREPATH=3
LATER EDIT:
It seems that the problem appears when I have a space in the value of the parameter..for example something like the example below works :
msiexec /i "WKFS ReportGenerator.msi" /quiet JREPATH="c:\\;;BLA"
This however doesn't:
msiexec /i "WKFS ReportGenerator.msi" /quiet JREPATH="c:\\;;BLA a"
LATER EDIT 2:
These commands including spaces in the value work if using a simple cmd instead of PowerShell..
If you invoke from Powershell, you should use the call operator & This should then also work with parameters enclosed in quotes:
& msiexec /i `"My Installer.msi`" /quiet JREPATH=`"c:\BLA BLA`"
UPDATE: Since this was related to PowerShell. See Windows Installer PowerShell Module on github.com (scroll down for description, use releases tab for download). I haven't really tested it much, but it is from Heath
Stewart - Microsoft Senior Software Engineer (github).
Brief, inline sample:
install-msiproduct .\example.msi -destination (join-path $env:ProgramFiles Example)
How can I use powershell to run through an installer?
Get the Windows Installer PowerShell Module easier with WMF 5.0
The below was written before I realized that this was related to PowerShell.
Quick Suggestion: Maybe try this command line:
msiexec.exe /i c:\setup.msi /QN /L*V "C:\Temp\msilog.log" JREPATH="c:\MyPath"
Get rid of the double \\ in the path you specify (could be enough), and use the old style /QN switch instead of the /quiet switch. Some elaboration and details below.
Silent Installation: What installer is this? Is it a vendor package? Some sort of Java application I presume? This is how to install a normal MSI file silently:
msiexec.exe /i c:\setup.msi /QN /L*V "C:\Temp\msilog.log"
Quick explanation:
/L*V "C:\Temp\msilog.log"= verbose logging
/QN = run completely silently
/i = run install sequence
msiexec.exe: There are two types of switches for msiexec.exe - the old fashioned ones such as /QN (Command-Line Options) for silent installation which matches the newer /quiet that you are using (Standard Installer Command-Line Options).
To add properties you do as you have already done, add it to the command line:
msiexec.exe /i myinstaller.msi ADDLOCAL="Program,Dictionaries" SERIALKEY="1234-1234" /qn
Some Further Links:
How to make better use of MSI files (On how to deploy MSI files silently with or without transforms applied. First section only. The last section goes into a lot of details on other topics)
Batch script to install MSI (similar answer)
I have an .MSI installer that I created using WIX and works fine when opening the file from windows explorer or installing from a command window using msiexec /i. The problem is that I need to use /a to install it using a group policy when the computer turns on.
When using the /i option the ProgramFilesFolder value is set correctly to "C:\Program Files (x86)\".
When using the /a option the value of ProgramFilesFolder is set to "C:\", and then I get an error (on the Log) that says:
The installer has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2203. The arguments are: C:\Referrals.msi, -2147287035,
Note: I am not running the .MSI file from "C:\"
Try
msiexec /a TARGETDIR="c:\temp\location" /passive
I think you may have the msiexec.exe command line mixed up: /a is admin install. This is essentially a command to create a network installation point with extracted files to use for installation on a lot of computers. This ensures the source files are available for patching, self-repair, repair, reinstall, etc...
To deal with advertisement and group policy you need to use these command line options. So a very basic operation would be advertise product to all users silently and write a log file:
msiexec.exe /JM "Installer.msi" /QN /L* "C:\msilog.log"
I'm using IExpress to generate .exe installer.
I want to make it generate log file into temp folder like this.
msiexec /i MyPackage.msi" /l*v "%temp%\MyPackge.log"
but after a bit of research I found that IExpress use command.com not cmd.exe so that it doesn't understand %temp%
So, I try changing it to
cmd.exe /c msiexec /i MyPackage.msi" /l*v "%temp%\MyPackge.log"
it seems work but there is a command prompt appears while installing which is not nice at all.
Anyway to fix this ?
you can choose to install /q quiet with no UI and /norestart options
msiexec command line options http://msdn.microsoft.com/en-us/library/windows/desktop/aa367988%28v=vs.85%29.aspx
You can hide the cmd.exe window by changing the Show window option to Hidden in the IExpress Wizard. In the .sed file, this would be:
ShowInstallProgramWindow=1
I end up with this.
msiexec /i MyPackage.msi" /l*v "..\MyPackge.log"
because the .msi has been extracted to %temp%\MyProduct, that's why I can use "..\MyPackage.log"
I installed an test application which has two features (FirstFeature & SecondFeature). I want to remove only one feature (SecondFeature) from the application. I tried using REMOVE property in command line. Here is the command used to remove SecondFeature.
msiexec /x RemoveFeatures.msi REMOVE="SecondFeature" /L*V log.LOG
But it is uninstalling the complete application. Log file shows that REMOVE=ALL is added by default. Here is the log file details.
MSI (s) (24:B4) [17:39:05:231]: Command Line: REMOVE=SecondFeature REMOVE=ALL
MSI (s) (24:B4) [17:39:05:231]: PROPERTY CHANGE: Adding REMOVE property. Its value is 'SecondFeature'.
MSI (s) (24:B4) [17:39:05:231]: PROPERTY CHANGE: Modifying REMOVE property. Its current value is 'SecondFeature'. Its new value: 'ALL'.
It indicates REMOVE property value is overridden during uninstall process. Do I need to set any other property to remove a specific feature ?
Any help is appreciated. Thanks in advance !!!
As you noted, /x is for uninstall. A complete (ALL) uninstall.
Although it may be counter intuitive you want to do an install that removes a feature.
msiexec /i RemoveFeatures.msi REMOVE="SecondFeature" /L*V log.LOG
You may also wish to add /qb or /qn to make it non-interactive / silent.