MSI 失败的 HTA 安装程序

发布于 2024-08-09 05:12:54 字数 1792 浏览 8 评论 0 原文

我正在使用 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=安装”
  3. 更改 IE 中的 ActiveX 设置 - “初始化并编写未标记为安全脚本编写的 ActiveX 控件”至“提示”
  4. 将 localhost 添加到 IE 中的受信任站点列表
  5. 将兼容性元标记添加到 HTA 以在 IE7 仿真、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);
}

单击“安装”按钮时会调用该方法,如下所示

我在 Google 上进行了广泛的搜索,只在有人尝试安装 Silverlight 3 时发现了相关问题(该问题显然已得到修复)。有什么想法吗?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

一笑百媚生 2024-08-16 05:12:54

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

我使用 VBScript 并启动 MSI

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

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
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文