[wix-users] Setting TARGETDIR for quiet install

Brian E brianke at gmail.com
Wed Mar 18 09:29:28 PDT 2020


I am trying to create a powershell script to do a quiet install of our
product.  This is the line I have in PS to run the MSI file:

msiexec /a $msiFile /passive /l*v ".\HRACtions Install Log.txt"
SERVICEACCOUNT="sa" PASSWORD="8Scripture4D34M"
CONFIRMPASSWORD="8Scripture4D34M"

This appears to run correctly and the log file indicates that the product
installed correctly.  The problem I am having is the product is being
installed in the wrong directory.  It is being installed to "C:\" when it
should go to "C:\Program Files (x86)"

In the log file I see that the TARGETDIR is being set to "C:\" (PROPERTY
CHANGE: Adding TARGETDIR property. Its value is 'C:\'.)

I tried to add a parameter to the PS script to set the TARGETDIR like this:

msiexec /a $msiFile /passive /l*v ".\HRACtions Install Log.txt"
SERVICEACCOUNT="sa" PASSWORD="8Scripture4D34M"
CONFIRMPASSWORD="8Scripture4D34M" TARGETDIR="C:\Program Files (x86)"

However, now when I run the PS script, I get the Windows Installer pop-up
window displaying all the msiexec options which typically indicates
something is wrong with the call to msiexec.

Is there a way to set the TARGETDIR from msiexec?  Or is there a different
parameter i should be setting?

My Product.wxs is setting the file structure like so:

  <!-- Directory setup -->
  <Fragment>
    <!-- Setup 'Program Files' folder for 'Delphia Consulting\HR Actions'
-->
 <Directory Id="TARGETDIR" Name="SourceDir">

      <!-- 'Program Files' or Program Files (x86)' -->
   <Directory Id="ProgramFilesFolder">
          <Directory Id="COMPANY_DIRECTORY" Name="$(var.CompanyName)">
            <Directory Id="INSTALL_FOLDER" Name="$(var.ProductName)" >
            . . .

Brian

If you can't explain it simply, you don't understand it well enough.  -
Albert Einstein


More information about the wix-users mailing list