Create "invisible" bootstrapper for my msi

0

I have an msi that I created with WiX. I have no need to create a chain bundle, but I do need the ability to have the user right-click on the installer and choose "Run as administrator". You can't do that with an MSI in Windows, only with EXE's.

Is there a way to create a bootstrapper exe that has no UI of its own that will just kick off my msi?

Here's why I think need to do this (in case there's another solution out there):

My WiX installer installs a certificate using the following code:

<iis:Certificate Id="ClientCert"
                                     Name="MyClientCert"
                                     StoreName="personal"
                                     StoreLocation="localMachine"
                                     Request="no"
                                     Overwrite="yes"
                                     BinaryKey="ClientCertBinary"
                                     PFXPassword="mypassword"/>

When I run this on some computers while log in as admin, the certificate installs fine. But when I run it on some other computers, also while logged into an admin account, the install fails with the following error:

InstallCertificates:  Error 0x80090010: Failed to open PFX file.
InstallCertificates:  Error 0x80090010: Failed to get SHA1 hash of certificate.
InstallCertificates:  Error 0x80090010: Failed to resolve certificate: MyClientCert

I read on another post that the UAC sometimes behaves differently in regards to this. The person recommended right-clicking and picking "Run as administrator". I tried this by opening a command window as admin and running the msi and it worked like a charm. But opening a command window is not an option for when we release the msi to our customers. Hence the need for an exe bootstrapper.

wix
windows-installer
bootstrapper
asked on Stack Overflow Mar 17, 2021 by Brad Y. • edited Mar 17, 2021 by Brad Y.

1 Answer

-1

This is not really the answer to your question but you can have the right-click "run as administrator" option for a MSI file, by adding these registry keys :

  • add the option without admin rights, in the HKCU hive :

      Windows Registry Editor Version 5.00
    
      [HKEY_CURRENT_USER\SOFTWARE\Classes\Msi.Package\shell\RunAs]
      "HasLUAShield"=""
    
      [HKEY_CURRENT_USER\SOFTWARE\Classes\Msi.Package\shell\RunAs\Command]
      @="\"C:\\Windows\\System32\\msiexec.exe\" /i \"%1\" %*"
    
  • add the option with admin rights :

      Windows Registry Editor Version 5.00
    
      [HKEY_CLASSES_ROOT\Msi.Package\shell\RunAs]
      "HasLUAShield"=""
    
      [HKEY_CLASSES_ROOT\Msi.Package\shell\RunAs\Command]
      @="\"C:\\Windows\\System32\\msiexec.exe\" /i \"%1\" %*"
    
answered on Stack Overflow Mar 17, 2021 by Christophe

User contributions licensed under CC BY-SA 3.0