Search code examples
wixwindows-installersccm

Msiexec a MSI package with passive got different results in administrator command prompt and normal command prompt


I tried to make up wxs to build a MSI package. The target is to passive install in Standard User account. This MSI copies files, writes HKCU registry, creates folder under %LOCALAPPDATA% and creates a shortcut on desktop, as follows.

<Directory Id="TARGETDIR" Name="SourceDir">
 <Directory Id="ProgramFiles64Folder">
    <Directory Id="INSTALLDIR" Name="Hello RMA">
       <Component Id="files" Guid="{0f8e0c9f-5248-4a88-90a3-8f08564bf7b9}">...</Component>
   
       <Component Id="Mode" Guid="{0ee73a0b-a204-4e0f-a604-8057f69ad837}" Win64="yes">
            <RegistryValue Id="Mode" Root="HKCU" Key="Software\Hello RMA" Name="Mode" Value="Tablet" Type="string" KeyPath="yes" />
       </Component>
       <Directory Id="Application_Dir" Name="Application">
           <Component Id="chrome_100_percent.pak" Guid="{eec8284f-d402-490a-a017-91f42779c848}">
                <File ... />
                ...
           </Component>                         
           <Component Id="HelloRMA.exe" Guid="{b973cdcc-d9e5-4cd2-903a-7e8886504833}" Win64="yes">
                <File Id="HelloRMA.exe" Name="Hello RMA.exe" Vital="no" DiskId="1" Source="payload\Application\Hello RMA.exe" />
                <Shortcut Id="HelloRMA.exe_1" Directory="DesktopFolder" Name="Hello RMA" Target="[#HelloRMA.exe]" Description="Hello RMA.exe" Hotkey="0" IconIndex="0" Show="normal" WorkingDirectory="Application_Dir" />
                <RegistryValue Root="HKCU" Key="Software\Hello RMA" Name="UI installed" Value="1" Type="string" KeyPath="yes" />
           </Component>                
       </Directory>
    </Directory>
 </Directory>
 <Directory Id="DesktopFolder" Name="DesktopFolder" />
 
 <!-- Create folders in AppData -->
 <Directory Id="LocalAppDataFolder" Name="LocalAppDataFolder">
    <Directory Id="HelloRMA_Dir" Name="Hello RMA">
        <Directory Id="NewFolder_Dir" Name="log">
            <Component Id="NewFolder" Guid="{7afcd67e-079b-4619-8430-f4ee7ef41275}">
                <CreateFolder Directory="NewFolder_Dir" />
                <RegistryValue Root="HKCU" Key="Software\Hello RMA" Name="Log folder installed" Value="1" Type="string" KeyPath="yes" />
                <RemoveFolder Id="RemoveLogDir" Directory="NewFolder_Dir" On="uninstall" />
                <RemoveFolder Id="RemoveRMADir" Directory="HelloRMA_Dir" On="uninstall" />                          
            </Component>
        </Directory>                
    </Directory>
 </Directory>

It works well when running it with the following command under normal command prompt with prompt for credentials.

msiexec /i rma.msi /passive

If running the same command under administrator command prompt, registry, folders in %LOCALAPPDATA% and shortcut would not be installed. Only files were copied to INSTALLDIR. Why are they different? Anything wrong in my WXS?

Another question is I wonder if MSI is deployed to user PC by SCCM. What environment will it be executed? Administrator command prompt or normal command prompt? Thanks.


Solution

  • A verbose log file would tell you for sure. However, I bet the missing files and registry keys are still being installed but installed into a different user profile where you are not looking.

    All the resources you list as "missing" are installed to the user profile (LocalAppDataFolder and HKCU), so they will be installed to the user profile that launched the install.

    So my guess is that your elevated command prompt is running as a different user than your normal command prompt.