[wix-users] Setting TARGETDIR for quiet install

Edwin Castro egcastr at gmail.com
Wed Mar 18 09:54:22 PDT 2020


Did you really intend to do an administrative install? That is what you're
requesting with msiexec /a.

TARGETDIR must end with a backslash. Assuming you really want to do an
administrative install to C:\Program Files (x86), try something like

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

NOTE: I've run into problems in the past trying to include a backslash at
the end of a quoted string. It kept getting interpreted incorrectly in
weird ways. I would try making this work on a command prompt first, then
get it working in a powershell window. You may need to play with different
quoting options... Or do an administrative install to a path without spaces
to avoid the quotes all together.

msiexec /a $msiFile /passive /l*v ".\HRACtions Install Log.txt"
SERVICEACCOUNT="sa" PASSWORD="8Scripture4D34M"
CONFIRMPASSWORD="8Scripture4D34M"
TARGETDIR=C:\Path\To\Admin\Install\TargetDir\NoSpaces\

If you really wanted to do a normal install then you should be using
msiexec /i which will resolve ProgramFilesFolder, etc., normally.

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

--
Edwin G. Castro


On Wed, Mar 18, 2020 at 9:39 AM Brian E via wix-users <
wix-users at lists.wixtoolset.org> wrote:

> 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
>
> ____________________________________________________________________
> WiX Toolset Users Mailing List provided by FireGiant
> http://www.firegiant.com/
>



More information about the wix-users mailing list