1

Essentially I would like to install an msi file silently, and I've got it to work using the following line:

msiexec /i C:\Users\%username%\Downloads\mysqlODBC.msi /passive

One addition I would like to make is to add double quotes to the user name portion of the line to ensure any usernames that may contain spaces are read correctly. ----> "%username%"

The issue is the msi file fails to install when I add this. I have always used this when writing batch scripts with directories. Any idea how this can be addressed to work with msiexec?

Link to MSI file I am trying to quietly install:

https://dev.mysql.com/downloads/file/?id=484649

  • 2
    I assume you mean, `msiexec /i "C:\Users\%username%\Downloads\mysqlODBC.msi" /passive`, not `msiexec /i C:\Users\"%username%"\Downloads\mysqlODBC.msi /passive`. That said, I'd suggest that, `msiexec /i "%UserProfile%\Downloads\mysqlODBC.msi" /passive` may work for you too. What exactly is your question, because you don't appear to have clarified what exactly does or doesn't work with the code you have provided. – Compo Apr 01 '19 at 21:20
  • Can we ask why you invoke the installation from the Downloads folder and not from a UNC network path? Surely you don't want each user to download the installer? You would want to download once, malware check and then rely on what you downloaded once and for all? – Stein Åsmul Apr 02 '19 at 10:42

2 Answers2

1

Network Installation Point?: It is not quite clear to me what you are trying to achieve. Do you want to automate the installation of this MSI on many machines? If so you should create a network installation point accessible via a UNC path and run an administrative image to extract all files and create a network installation point that can be used for all computers:

msiexec.exe /i "\\Server\Share\Setup.msi" /QN /L*V "C:\Temp\msilog.log"

If you have that instillation point there really is no reason to make a folder for each user. Why duplicate installation files? Surely you don't want each user to download the installer? You would want to download once, malware check and then rely on what you downloaded once and for all?

Anyway, if you insist:

msiexec.exe /i "\\Server\Share\%username%\Setup.msi" /QN /L*V "C:\Temp\msilog.log"

Quick Parameter Explanation:

 /i = run install sequence 
 /QN = run completely silently
 /L*V "C:\Temp\msilog.log"= verbose logging at specified path

msiexec.exe: See this answer for some further details on the msiexec.exe command line: MSIEXEC what is the difference between qn and quiet. There are two different flavors of it - two different sets of switches: old style and some newer, "friendlier" versions. I only use the old style switches. There is a tool you can use to generate the command lines.


Some Links:

Stein Åsmul
  • 39,960
  • 25
  • 91
  • 164
0

TL; DR :

pushd "C:\Users\%username%\Downloads\"
msiexec.exe /a "mysqlODBC.msi" /quiet /norestart /log "%cd%\msiexec_install.log"
popd

Details :

While the fully qualified path should be able to placed in-between double-quotes, an alternative option would be to use pushd and popd to move to an from the directory containing the MSI.

In the example above, I replaced the progress bar (aka /passive) with /quiet. I also used /a rather than /i out of habit - either can be used to install. And I included a log-to-file option which can be useful in troubleshooting.

Community
  • 1
  • 1
  • 1
    The switch **`/a`** is [**administrative installation**](https://stackoverflow.com/a/5751980/129130). This is completely different from installation. In effect it is a file extraction from the MSI to create a network installation point from which further installs can be run on other systems. It does not run the normal installation process at all (`InstallExecuteSequence`), rather it extracts files and modifies the media table to use the external files rather than the internal cabs for installation (that means running the `AdminExecuteSequence`). – Stein Åsmul Apr 02 '19 at 13:39
  • I have actually tried using /quiet for this particular msi file with no luck. The batch file seems to load for a second and than it disappears. This is the msi file I would like to quietly install: https://dev.mysql.com/downloads/file/?id=484649 –  Apr 02 '19 at 13:57
  • I think there are numerous problems with those MySQL installers. Let me have a quick look. [Here for one](https://stackoverflow.com/questions/26047524/mysql-installer-stuck-on-starting-service). Firewall, service start, etc... There was more elsewhere. [Another one](https://stackoverflow.com/questions/26755711/mysql-installer-error-on-mysql-installer-community-5-6-21-1-msi). [One from me here](https://stackoverflow.com/a/50499193/129130). – Stein Åsmul Apr 02 '19 at 14:33
  • [**And here is the answer I was looking for**](https://stackoverflow.com/questions/51293749/how-to-install-mysql-unattended-with-custom-settings). How to automate the installation of MySQL. Not sure it is the same installer, but the one I looked at was a real beast and full of unorthodox solutions and some lunacy. Give it a quick read please. Dealing with it was - as I recall - a journey of discovery with regards to an installer that does it all wrong, but sort of works when you use its approach. – Stein Åsmul Apr 02 '19 at 14:40