msiexec: Default to "do not close application" in silent mode - wix

I want to install my program with a quiet msiexec command such as:
msiexec /i file.msi /qn
However, if the application happen to be running, it will default to closing the application. I want msiexec to default to never close the application, but instead install on next reboot.
Is this possible as a command line option or through how the msi is built in wix?
Edit: I am installing a service btw

Take a look at the REBOOT property.
You probably want to add REBOOT=R.

Related

Microsoft Installer command line string parameter not working?

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)

how to create installation log file in Target folder in wix

i am using the following command to see the logs in wix installer.
msiexec /i "D:\WixProjects\DFServicesWixSetup\DFServices\bin\Debug\DFServices.msi" /L*V "D:\DFServices.log"
but this command is trying to install the msi again.
I want to execute this command from wix after finishing the installation and log file need to save in installed folder.
can any one help me on this.
You need to decide in advance if you want Windows Installer to make a log file. You also need to decide in advance where it should go. If you want it to end up in the install folder then you either need to copy it there after installation or specify the install folder in advance, too.
In Windows Installer folders are controlled by properties. You can specify such properties in the command that starts installation. The name of the property for the "install folder" depends on how the installer authoring; INSTALLFOLDER is one typical name.
So, you could do this with a command like this:
msiexec /i "D:\WixProjects\DFServicesWixSetup\DFServices\bin\Debug\DFServices.msi" /L*V "D:\path\DFServices.log" /qb INSTALLFOLDER="D:\path"
The /qb switch is reduce the UI such that the user is offered the chance to change the installer folder. It may more may not be need for your installer, depending on what dialogs its UI normally shows.
So, the first step is to figure out which property sets the install folder in your installer.

ProgramFilesFolder Set to C:\ when using /a switch for msiexec

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"

Silently install Apache through Advanced Installer

I am trying to silently install apache using Advanced Installer 8.9, but it is still prompting me for user interaction even though I pass the command parameters in the Silent (No UI) field.
msiexec /i "httpd-2.2.22-win32-x86-no_ssl.msi" /qn /passive ALLUSERS=1 SERVERADMIN=admin#localhost SERVERNAME=localhost SERVERDOMAIN=localhost SERVERPORT=80
What can I do to solve this?
The parameters set in "Silent (No UI)" field are used by the prerequisite only if the bootstrapper is running with silent UI. If you want these parameters to be used for all the UI levels of the bootstrapper you need to set the same command line in all fields, i.e. Full UI, Basic UI and Silent (No UI).
Agree with #bogdan. Also, I noticed that you pass the entire msiexec command into the parameters. If you have specified apache as a prerequisite, you only need to pass the arguments of msiexec in the command parameters, e.g. /qn, /passive etc. You shouldn't pass "msiexec" as command line parameters.

What is the best way to specify whether InstallPrivileges is limited or elevated at the command line in WIX?

I want to create an MSI in WiX such that it can take a command line parameter to indicate whether it is a per-machine or per-user installation and consequently whether to raise a UAC dialog.
What is the best way to accomplish this?
This is the link for per-machine/per-user from MSDN.
so to change the values from the command line parameter, you'll need something like so:
msiexec /i myinstaller.msi ALLUSERS=[1|2]
Also, have a look at this link from wix-users
The UAC dialog is controlled by a bit in the SummaryInformation stream. That, unfortunately, means it cannot be controlled at "run time" (install/repair/uninstall). You have to build different MSI files to truly change the UAC prompt.
I haven't been able to test in Vista yet, but what works in XP for limited user per user install and admin user per machine install is the following:
msiexec /i myinstaller.msi ALLUSERS="" INSTALLDIR="C:\Documents and Settings[Username]\Local Settings\Application Data\My COmpany\My Program"
The INSTALLDIR can be anything that a limited user can write to. The above is the directory Google Chrome uses. Found from the following link that the ALLUSERS property can actually be blank which is distint from 1 or 2 and that correctly sets the ProgramDir and Desktop locations
http://blogs.msdn.com/astebner/archive/2007/11/18/6385121.aspx