HTA安装程序无法安装MSI文件。

5
我正在使用HTA尝试使用WindowsInstaller.Installer作为ActiveXObject安装产品。使用过去使用过的相同HTA模型,尝试安装会引发错误:“Msi API Error: 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);
}

当点击“安装”按钮时,方法如下所示被调用: 我已经进行了广泛的谷歌搜索,只发现有人在尝试安装 Silverlight 3 时遇到了相关问题(似乎已经修复)。有什么想法吗?

你尝试过在Windows脚本宿主.wsf文件中运行相同的脚本吗?如果是,结果是否相同? - dreftymac
我在XP机器上使用非管理员帐户运行了您的示例,它可以正常工作。(只删除了“display:none;visibility:hidden;”)所以这可能是特定于Vista/2003? - Paul
1
在我的Windows 7上似乎运行良好。您是否检查了应用程序事件日志(应该来自MsiInstaller)以获取“真正”的错误代码? - tyranid
另一个值得尝试的事情可能是在您的注册表中启用Windows Installer日志记录:http://support.microsoft.com/kb/223300 - Phil Booth
1个回答

1

我在安装设置中遇到了类似的问题。

我使用了VBScript并启动了MSI。

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

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接