MSI installation quietly with default values - installation

I am writing a powershell script to uninstall and install a product. Uninstallation and installation process is just clicking on several next buttons with default values populated.
Could you please suggest how to install the MSI file without prompting user for clicking on several next buttons and complete the installation process very quietly.
If I wanted provide customized values during the installation, what could be the process to find out the property names and how to run it silently. Please refer to any references to explore further.
I am using powershell 2.0 and please let me know if further information is needed. Thanks in advance.
Regards,
Kumar

To install a .msi file silently, you should be able to use the /quiet switch with msiexec.
If you need to customize anything, you can set property values like this: PROPERTY=Value
Altogether:
msiexec /i C:\Path\To\File.msi /quiet PROPERTY=Value
To see all the options, just run msiexec without any parameters.
This question is also very similar to yours.

You can do this only if the MSI helps you :). For example, if a property called SERVERNAME is set to FRED in a dialog, then you could say SERVERNAME=FRED on the command line. This assumes that the InstallExecuteSequence that does the work of the install uses just the value FRED. Problems occur when the UI sequence does extra things that won't happen in silent mode because the UI sequence doesn't run in a silent install. If the UI sequence dialogs change SERVERNAME by (for example) adding \ to the front and \MyShare at the end and \FRED\MyShare is used in the execute sequence then you need to know set the command line to SERVERNAME="\FRED\MyShare" because that's what the execute sequence expects. If you don't know all the potential relevant property values you could run the install in UI mode with a verbose log and see them. So in the absence of documentation for silent install you need to reverse engineer it a bit.
If you want to specify what features are to be installed then use ADDLOCAL=comma separated list of feature names.

The basic command line for running silently is (paths truncated):
msiexec.exe /I "C:\WiX.msi" /QN /L*V "C:\msilog.log" MYPROPERTY=1
You can also apply a transform (see explanation below):
msiexec.exe /I "C:\WiX.msi" /QN /L*V "C:\msilog.log" TRANSFORMS="C:\Wix.mst"
/QN: run silently, no GUI during or after the install
/L*V: write verbose log file with all information
MYPROPERTY: set a property at the command line. You can set multiple.
The way an MSI file is supposed to be modified for corporate use is to use a transform file (*.mst).
This is a little "database snippet" that can change the MSI file (which is a database) once applied to it during runtime.
A transform can literally change anything in the MSI, but most often it is used to adjust small things such as removing shortcuts, eliminating undesired runtimes, etc...
A transform is applied to an MSI on the msiexec.exe command line by adding the keyword TRANSFORMS followed by the path to the *.mst file.
You can also uninstall MSI files in a variety of other ways (besides the msiexec.exe command line). Here is a rough guide for how to uninstall MSI files. It includes information on how to uninstall with PowerShell, WMI, VBScript Automation, etc... And there is another post on serverfault.com on the issue of avoiding the use of msiexec.exe to prevent unwanted dialog boxes from popping up during automated runs.

Related

InstallShield silent install CR Runtime 13.0.17

Hi, I create a Setup with Installshield 2015. my setup has a prerequisites for reporting viewer so i want to install CR_Runtime13.0.17.msi silently. for this situation we want a command to start the cr_runtime setup silent, after many searches on the net i found this command.
msiexec /i IsSetupPrerequisites\CR_Runtime13\CR_Runtime13.0.17.msi /qb /norestart
when i use this command on Cmd it works well and setup is begins silently with progress bar but when i use this command on installshield, it show me an error and a help every time.
please help me to create a command for installshield to install cr_runtime13.0.17 silently.
at the end i Attached installshield command page and my help to this Question.
Many Thanks to all
The Specify the command line for the application value is really just the arguments. From Specifying Command-Line Parameters for an InstallShield Prerequisite:
Type any valid parameters for the file that is selected in the Specify the application you wish to launch list. Do not include the name of the file in this box.
Remove your inclusion of msiexec and an attempted relative path to the msi, leaving you with just /qb /norestart, and you should avoid the msiexec error. If that one still gives you problems, consider replacing /norestart with REBOOT=ReallySuppress.
I had to create a prerequisite for .net 4.6.1 and it worked silently when I had only /q /norestart in the command line and command line for silent mode.(instead of /qb /norestart)

Passing config file to MSI as argument and need to use it by Custom action with Silent Installation

I have created Basic MSI Project for creating installer for my project in Installshield 2014 and it is working fine. I have also created a custom action to execute my exe file while installing the application.
Then i create a Silent Installer using (/s) command line argument. I want to pass the Config file to my MSI setup and one of my Custom Action exe file need this Config file to setup basic project setup.
e.g
Installer.msi /s "c:\project\config.txt"
How to pass this config file parameter to my exe as command line argument?
I have searched in google and existing questions also. I didn't get way to do this.
Till now i didn't get any way to do this. Please anyone help me to do this.
Thanks in advance.
You can pass values to your MSI by command line. This is one way to pass values straight into your MSI, another way is using a transform to modify the MSI. See this answer: Using msiexec.exe custom command lines, or using transform files.
As far as I know there is no limit to how many values you can pass by command line:
msiexec.exe /I "C:\Install.msi" /QN /L*V "C:\msilog.log" STARTAPP=1 FIREWALLRULE="Long string here"
Quick explanation of command line above:
/L*V "C:\msilog.log"= verbose logging
/QN = run completely silently
STARTAPP="1" = Your property indicating the app should be started after install
FIREWALLRULE="Long string here" = Your firewall rule to apply via a custom action
Yes, Glytzhkof is right.
According to your question, you are free to "invent" an own property e.g. CONFIGFILE and pass on the commandline something like CONFIGFILE="C:\myconfig.ini" or something similar.
If the path is always the same (e.g. in SOURCEDIR), you can avoid the whole path and add it in your code, but don't rely on the source for a patch (.msp) for example.
I am not sure if I understand, what you mean exactly with "silent installer".
You can call every msi setup with the parameter "/qn" (or "/quiet") silently. The "/s" parameter does not belong to MSI, but is more common for setup.exe files (bootstrappers) or InstallShield script projects. Of course you can combine a bootstrapper with a MSI called.
For example, using the InstallShield built setup.exe could be something like:
setup.exe /s /v "/qn CONFIGFILE=myconfig.ini"

msiexec does not pass parameters from the command line

I was trying to use MSI installer to install this file myInstaller.msi and also pass the value "192.168.2.1" to IPADDRESS, which is mandatory on the process of installation. However, it comes up an error message "install failed". I checked on Windows, the application is installed, but it's not on Windows Services, where it is supposed to be.
msiexec /i myInstaller.msi IPADDRESS=192.168.2.1
I also have read this link msiexec does not pass parameters to custom action. There is comment saying that installing ORCA and then editing the MSI file, it should work, however, after I have deleted cut row containing CustomTextC_SetProperty_EDIT1, and then saved the MSI file, it seems it's broken, it can not even run, the file is damaged.
Any help for this? I have been working almost 2 days trying to work it out, but can't. :-(
I'll try to answer with a potential quick fix rather than a long explanation:
Open an unharmed copy of the MSI file with Orca
Add to the Property table:
Property column: IPADDRESS Value column: 192.168.2.1
Then add IPADDRESS to the delimited list in SecureCustomProperties. See image below
Save and close, and run the MSI
Open an elevated cmd.exe prompt (search in start menu for cmd.exe, right click and run as administrator)
Install with command line (modify with your own paths): msiexec.exe /I "myInstaller.msi" /QN /L*V "C:\msilog.log"
Check results, and report here what you find. Most likely there is something else wrong, but this will bypass most other error sources.
I do not recommend this approach as anything but a quick test.

How to Create a script via batch file that will uninstall a program if it was installed on windows 7 64-bit or 32-bit

I am in a small bind. The program in question can be installed in the program files directory (64bit) or X86 path. The program is already installed in over 200 machines. I am fairly certain the default install path was X86 as that's the default. I am not certain and must cover both scenarios. The original sys admin that installed this didn't use an .msi so I'm left with what I've found as ""C:\Program Files\InstallShield Installation Information{78AC336D-25F6-4916-A711-2EA2F69E0319}\setup.exe" as the command provided by one utility to remotely uninstall said application I found. Didn't work and I cannot attempt to push this out in hopes it'll work.
Given this problem, is there a way to uninstall this program via a script that would check both program files and X86 paths and uninstall depending on location? OR, is there a script that will just flat out uninstall the program regardless without the concern for the X86/program original install location. I just need to uninstall it period across all of these machines. The install .bat is good to go. What I cannot do is just get window to uninstall X application via a script for 32 or 64 bit machines.
I've tried MsiExec.exe /X{78AC336D-25F6-4916-A711-2EA2F69E0319} /quiet with no go. I can try to install the .msi this time around but am lost and my knowledge is limited with scripting or any uninstall scripts for telling "end users" without confusing them to just click here. I could tell them to go to control panel, etc..but they'll be lost....typical.
Any ideas on how to script this uninstall given it wasn't an original .msi and I am not sure how to get something working? I'm open to anything. I have two days to get this fixed and I'm in panic mode...
Any ideas or help on code would be greatly appreciated.
Regards,
Brian
wmic can call an uninstaller. I haven't tried this, but I think it might work.
wmic /node:computername /user:adminuser /password:password product where name="name of application" call uninstall
If you don't know exactly what the program calls itself, do
wmic product get name | sort
and look for it. You can also uninstall using SQL-ish wildcards.
wmic /node:computername /user:adminuser /password:password product where "name like '%j2se%'" call uninstall
... for example would perform a case-insensitive search for *j2se* and uninstall "J2SE Runtime Environment 5.0 Update 12". (Note that in the example above, %j2se% is not an environment variable, but simply the word "j2se" with a SQL-ish wildcard on each end. If your search string could conflict with an environment or script variable, use double percents to specify literal percent signs, like %%j2se%%.)
If wmic prompts for y/n confirmation before completing the uninstall, try this:
echo y | wmic /node:computername /user:adminuser /password:password product where name="whatever" call uninstall
... to pass a y to it before it even asks.
I haven't tested this, but it's worth a shot anyway. If it works on one computer, then you can just loop through a text file containing all the computer names within your organization using a for loop, or put it in a domain policy logon script.
Further reading on wmic
More reading on wmic
Assuming you're dealing with Windows 7 x64 and something that was previously installed with some sort of an installer, you can open regedit and search the keys under
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall
(which references 32-bit programs) for part of the name of the program, or
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
(if it actually was a 64-bit program).
If you find something that matches your program in one of those, the contents of UninstallString in that key usually give you the exact command you are looking for (that you can run in a script).
If you don't find anything relevant in those registry locations, then it may have been "installed" by unzipping a file. Because you mentioned removing it by the Control Panel, I gather this likely isn't then case; if it's in the list of programs there, it should be in one of the registry keys I mentioned.
Then in a .bat script you can do
if exist "c:\program files\whatever\program.exe" (place UninstallString contents here)
if exist "c:\program files (x86)\whatever\program.exe" (place UninstallString contents here)
In my experience, to use wmic in a script, you need to get the nested quoting right:
wmic product where "name = 'Windows Azure Authoring Tools - v2.3'" call uninstall /nointeractive
quoting both the query and the name. But wmic will only uninstall things installed via windows installer.

How to pass command line arguments to InstallShield debugger?

When running the InstallShield X debugger I can't find a way to tell it to run silently in order to debug a silent install.
The debugger seems to run the equivalent of a "setup.exe" command line which displays the GUI, but I want "setup.exe /s" which takes input from setup.iss.
Is there a way to specify command line parameters for debugging?
There are multiple ways to start the InstallScript debugger. You can start it from the InstallShield IDE, which is what I expect you're doing. Or you can start it from the command line of your setup with /d. Mix the /s and /d together, and you should be able to debug the silent case. Or if this is an InstallScript MSI, you may also want to set certain MSI properties to enable debugging of custom actions.
See Setup.exe and Update.exe Command-Line Parameters for details, looking at the Debugging section which describes both /d and /v"ISSCRIPTDEBUG=1 ISSCRIPTDEBUGPATH=\"path-to-Setup.dbg\""

Resources