Install msi with msiexec in silent mod and specific directory - cmd

I have setup.msi file. I need to run the installation from the command line in silent mode. It is also necessary to specify the path where will this installation. I tried to use TARGETDIR and INSTALLDIR parameters, but the installation going is in the default folder:
msiexec.exe /i c:\setup.msi TARGETDIR="c:\result" /qb
Also if you run this command again, the installation will not happen, because msiexec think that the product is already installed. In this case, I need to get the product installation in the specified directory and the version value in the registry has been updated.
How can I install product in a specific directory regardless of whether the product is installed or not.

Basically, your commandline is not wrong. But, which variable is the correct one, is strongly dependent on the msi package itself, it is not a rule, that TARGETDIR works. At least it works for MSI files following best practices. Normally TARGETDIR is correct, and for InstallShield-builds is INSTALLDIR working best.
But if someone has authored the folder directly as ProgramFilesFolder, then this is fixed.
Download Orca or better InstEd or a similar tool and you have to look inside the MSI file.
Your second question:
"How can I install product in a specific directory regardless of whether the product is installed or not?"
This is not directly possible. Windows Installer has rules, and these don't allow multiple installation in different directories without further effort:
Moreover I am not sure why do you want this:
Here is a bit more knowledge for this:
Normally, everyone who wants to install in another directory, first uninstalls the product. That is standard practice. With commandline parameter /x you can uninstall it. Then install with a new path.
Your are correct, if you install a second time with your (same) command line, nothing will happen or change. Instead of an uninstall a repair (correction) is possible. Use the additional parameters REINSTALL=ALL REINSTALLMODE=vemus for this as a good default.
But as said, it is not possible to change installation path with this.
If you really mean this: For having installed multiple "copies" of the same software in different directories, things are a bit tricky with MSI. I recommand professional MSI knowledge for this so maybe you would need paid consult for that. Most people use copy scripts instead of MSI for such things. But when you want to have real multiple setup versions installed, search for MSDN entry "Installing Multiple Instances with Instance Transforms" as a first starting point.

I use powershell to check if it's already installed and install it if it's not already.
x86 MSI:
((Get-ItemProperty HKLM:\\Software\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\* | Where { $_.DisplayName -like \"*[APPLICATION_NAME]*\" }) -ne $null)
X64 MSI:
((Get-ItemProperty HKLM:\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\* | Where { $_.DisplayName -like \"*[APPLICATION_NAME]*\" }) -ne $null)
You can take the result and store it in a variable if you want such as $ApplicationInstalled and then condition your installation based on the result.
if (-not $ApplicationInstalled)
{
#MSI Install Commmand
}

Related

InstallShield Answer File Not Working for Install Path

I am attempting to run an older InstallShield 5.0 setup program using the silent (/s) option, however even after recording an iss file using /r, it does not automatically fill in the install directory/path. The relevant iss file section is as follows:
[SdSelectFolder-0]
szFolder=Some Folder
Result=1
I have also attempted to run setup.exe /v"/qn INSTALLDIR=D:\Some Other Folder" /f1"E:\Path\To\Setup.iss" to specify the install folder at run time, and replaced INSTALLDIR with szFolder since that's the parameter name, with absolutely zero success. Everything in the installer runs silently except the "select folder" page, which always comes up regardless of answer file or any options provided.
Is there anything that I can do to specify, either on the command line, or via iss file, this older program's install folder? Any help/direction would be amazing here!

Is it possible to install multiple programs via script?

I need to re-create the development environment on my machine, and put exact applications on co-workers machine ( not in same office ).
What We Need Installed
So basically we need a NativeScript development environment created.
This will include programs like, NativeScript CLI, Android Studio, Node, etc.
Ideal Solution
Ideally I would like to write a script that would install the necessary programs without any ( or minimal ) attendance .
Can someone show me how I would create such a script?
Thank you
You can install NodeJS silently by downloading the most recent MSI installer and running msiexec /qn /l* node-log.txt /i node-vX.X.XX-x64.msi. This will install Node and NPM.
Once you've installed NPM, you can install Nativescript with npm install -g nativescript
You can install the Android studio IDE silently with the /S switch, and the SDK silently using /S /Allusers.
You can set the Android_Home environment variable inside HKLM\System\CurrentControlSet\Control\Session Manager\Environment
References:
https://gist.github.com/manuelbieh/4178908
https://www.nativescript.org/blog/installing-nativescript-on-windows
http://www.edugeek.net/forums/windows-7/173153-android-studio-unattended-install.html#post1485712
You can use autoit to create script, code what and in what order need to be installed. Than you can either put all programs version on one usb with your script - in this way you can also controll version of software installed or call to download and install from internet.
You can also include GUI with the script as well as you can create .exe file and end user need just to execute it.
Another option would be to create .bat file and code step by step what need to be installed. Look at batch file command list to see what commands are available.
Those are just two options, possibilities are endless, depend on what you feel most comfortable.

Can I make a custom MSI that includes Vagrant, VirtualBox and other dependencies?

Summary: I want to figure out a way to automate the installation of a project and it's dependencies onto the Windows(7, 8) platform. In particular I want to install all the dependencies required to "vagrant up", and I want to distribute this to my team members.
Problems: I have considered using a freeware tool ( http://www.advancedinstaller.com/ ) to help me create an MSI. However i think vagrant is now only available to download with specialized MSI installers. see http://mitchellh.com/abandoning-rubygems
In addition to needing vagrant, I want to automate the installation of oracle virtualbox, and we need a few vagrant plugins.
I also want to include the project itself.I have a vagrantfile that has been tested and works well.
Restatment of the problem:
In other words, since Vagrant appears to provide only MSI installers for Windows, I don't know if it is still possible to create a custom msi that includes the other items I want. If it were possible I don't know how to do it. If there is a better way than using MSI, pease tell.
A Windows Installer package is not meant to be a recursive structure.
Try a WiX's Bootstrapper project to create an EXE with chained sub-installers. It uses the WiX burn engine, which is a bootstrapper, downloader (optional), bundler (optional embedding), chainer, reboot manager, package manager.
If you use Advanced Installer (as you mentioned) you can add Vagrant, VirtualBox and the other dependencies in the "Prerequisites" page to as described in their tutorials:
http://www.advancedinstaller.com/user-guide/tutorial-professional.html#prerequisites
You can automate their installation by setting command lines for them.
Have you tried using something like Chocolatey?
I've used it before to create BAT scripts to do the installation of Virtual Box and Vagrant on Windows 7.
Something like the following could be a place to start:
#echo off
if not exist C:\Chocolatey goto InstallChocolatey
echo Chocolatey already installed.
goto:InstallPrograms
:InstallChocolatey
#powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin
:InstallPrograms
call cinst chocolatey
call cinst virtualbox
call cinst vagrant

how to make an existing msi package unattended install

Sorry for the newbie-ish question, but for all my years, I've never dealt with windows installation except as a user and I'm not sure how to start this.
I have two 3rd party packages to install. One I know is msi based but the other I have not found out yet. It comes with a setup.exe and a wrapper.exe - which we use to install.
Both installation prompt the user for language and a number of various options.
I need to wrap or do something to make these unattended installations.
I may be able to get some property information and I've read Silent installation of a MSI package - is that how I go about doing this? There will be a boat load of properties.
Basically, how do I go about wrapping the setup.exe and building / providing some type of response file.
thanks,
jon
Try this procedure to test if the setup is an MSI:
In the folder where your setup.exe is located, hold down shift, and right click in an empty space. Click "Open new command window here".
Type in setup.exe /a and let the setup start. This should launch an "admin install" if the setup.exe is an MSI setup at all. If you see a way to specify a path, define one and press next. This should now extract all files from within the setup.exe exposing the MSI file.
Once you have the MSI file extracted, it can in most cases be installed via a standard msiexec.exe command line like this: msiexec.exe /i setup.msi
To learn how to install an MSI file silently, check this thread:
How to interactive a silently installing msi? (Progress data and cancel it)
Just one final question: are you delivering these setups as a product, or are you trying to install to your work network or similar?
If those wrapper/setup programs don't have a silent mode then the whole process can't be silent. As far as the MSI files are concerned, the msiexec command line stuff is what you need, including specifying properties on the command line, such as TARGETDIR- if the default is wrong, and TRANSFORMS= assuming the language choice is a transform choice. If you turn on Windows Installer logging policy (or the wrappers let you create a verbose log) you'll see what command lines the wrappers use, so duplicate them except you'd add a /qn type of option to make them silent. If they require elevation to admin to install you'd have to launch them from an admin prompt because a silent install won't ask for elevation on UAC systems.

Install JRE when the same version is already present

I'm trying to install a jre-6u43-windows-i586 on my computer in static silent mode. This is a part of another installer. I run
jre-6u43-windows-i586.exe /s STATIC=1 INSTALLDIR=D:\\java1
And it installs great. Then, I'm trying to install it one more time, like
jre-6u43-windows-i586.exe /s STATIC=1 INSTALLDIR=D:\\java2
and it does not installs till I delete previous installation via Programs and Features.
How can I create a completely standalone JRE installation, so it does not lists in Programs and Features, does not registers itself in registry and so on. So, that I can create as many embedded installations as I want.
P.S. I know that I can just pack once installed JRE and then unpack it anywhere, but maybe there is more proper way of doing this?
See if you can make use of the Portable Java that you can find here.
I think it does what you want and it won't clutter the registry.

Resources