MSI的HTA安装程序失败

Mat*_*ark 5 javascript windows-installer hta failed-installation internet-explorer-8

我正在使用HTA尝试使用WindowsInstaller.Installer作为ActiveXObject安装产品.使用过去使用的相同HTA模型,安装尝试会抛出错误:"Msi API错误:InstallProduct,PackagePath,PropertyValues".

我在Windows Vista和Server 2003上都试过这个,但没有成功.两者都使用IE8,所以我认为它可能是某种ActiveX兼容性问题.然后我在IE6中对它进行了测试并遇到了同样的问题 - 但是,我们过去曾多次将这种格式用于HTA并取得了成功.我试图从两台计算机上的管理员帐户安装,并且MSI本身按预期执行.

到目前为止,我尝试了以下内容:

  1. 将MSI的文件路径更改为绝对路径
  2. 将InstallProduct方法的"命令行设置"(第二个参数)更改为"ACTION = ADMIN"(强制管理员安装)和"ACTION = INSTALL"
  3. 更改IE中的ActiveX设置 - "初始化并编写未标记为可安全执行脚本的ActiveX控件"至"提示"
  4. 将localhost添加到IE中的受信任站点列表
  5. 将兼容性元标记添加到HTA以在IE7Emulation,IE5或IE6模式下运行

这是失败的方法/上下文:

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);
}
Run Code Online (Sandbox Code Playgroud)

然后在单击"安装"按钮时调用该方法,如下所示

<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>

我有广泛的谷歌搜索,只有当有人试图安装Silverlight 3(显然已经修复)时才发现相关问题.有任何想法吗?

Sum*_*ime 1

我的安装集也有类似的问题。

我使用 VBScript 并启动 MSI

Set sh = CreateObject("WScript.Shell")
l_command =  "%SystemRoot%\System32\msiexec.exe /i """ & sh.CurrentDirectory & "\" & p_file  & """"
sh.Exec l_command
Run Code Online (Sandbox Code Playgroud)