views:

492

answers:

1

I'm using a HTA to try to install a product using WindowsInstaller.Installer as an ActiveXObject. Using the same HTA model that has been used in the past, the attempt to install throws the error: "Msi API Error: InstallProduct,PackagePath,PropertyValues".

I have tried this on both Windows Vista and Server 2003 with no success. Both have been using IE8, so I thought it might be some sort of ActiveX compatibility problem. I then tested it in IE6 and encountered the same problem - however, we have used this format for HTAs several times in the past with success. I am attempting to install from an Administrator account on both machines, and the MSI itself executes as expected.

So far I have tried the following:

  1. Changing the file path for the MSI to absolute
  2. Changing the "command line settings" (the second parameter) for the InstallProduct method to "ACTION=ADMIN" (to force an administrator install) and "ACTION=INSTALL"
  3. Changing ActiveX settings in IE - "Initialise and script ActiveX controls not marked as safe for scripting" to "Prompt"
  4. Adding localhost to the trusted sites list in IE
  5. Adding compatibility meta tags to the HTA to run in IE7Emulation, IE5 or IE6 modes

Here is the method/context that is failing:

var Software = new Array(
    new Array("..\\Software\\Product.msi", "ProductCode"));

   function run_msi(i)
{
    try
    {
        //Execute MSI application install on error resume next
        var msi = new ActiveXObject("WindowsInstaller.Installer");
        var installer = Software[i][0];
        msi.UILevel = 5; // full interactive mode
        msi.InstallProduct(installer, "");
    }
    catch (e)
    {
        alert ("Unable to launch the Installer Package.  This may be because you do not have permission to install software.");
    }
    // Check the install status of the MSI to ensure it is in the registry
    RegistryKeyExists(i);
}

The method is then called when clicking on an "install" button as follows

<td><span class="link" style="display: none; visibility: hidden" id="SoftwareTextTrue0" onclick="javascript:run_msi(0);">Uninstall</span> <span class="link" style="display: none; visibility: hidden" id="SoftwareTextFalse0" onclick="javascript:run_msi(0);">Install</span> </td>

I have Googled extensively and only found a related issue when someone was trying to install Silverlight 3 (which has apparently since been fixed). Any ideas?

+1  A: 

I have a similar problem with my install set.

I used a VBScript and start the MSI

Set sh = CreateObject("WScript.Shell")
l_command =  "%SystemRoot%\System32\msiexec.exe /i """ & sh.CurrentDirectory & "\" & p_file  & """"
sh.Exec l_command
Andreas Hoffmann