我正在使用 HTA 尝试使用 WindowsInstaller.Installer 作为 ActiveXObject 安装产品。使用过去使用过的相同 HTA 模型,尝试安装会引发错误:“Msi API 错误:InstallProduct、PackagePath、PropertyValues”。
我已经在 Windows Vista 和 Server 2003 上尝试过此操作,但没有成功。两者都使用IE8,所以我认为这可能是某种ActiveX兼容性问题。然后我在 IE6 中测试它并遇到了同样的问题 - 然而,我们过去曾多次在 HTA 中使用这种格式并取得了成功。我尝试从两台计算机上的管理员帐户进行安装,并且 MSI 本身按预期执行。
到目前为止,我已尝试以下操作:
- 将 MSI 的文件路径更改为绝对
- 路径 将 InstallProduct 方法的“命令行设置”(第二个参数)更改为“ACTION=ADMIN”(强制管理员安装)和“ACTION=安装”
- 更改 IE 中的 ActiveX 设置 - “初始化并编写未标记为安全脚本编写的 ActiveX 控件”至“提示”
- 将 localhost 添加到 IE 中的受信任站点列表
- 将兼容性元标记添加到 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:
- Changing the file path for the MSI to absolute
- Changing the "command line settings" (the second parameter) for the InstallProduct method to "ACTION=ADMIN" (to force an administrator install) and "ACTION=INSTALL"
- Changing ActiveX settings in IE - "Initialise and script ActiveX controls not marked as safe for scripting" to "Prompt"
- Adding localhost to the trusted sites list in IE
- 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)
我的安装集也有类似的问题。
我使用 VBScript 并启动 MSI
I have a similar problem with my install set.
I used a VBScript and start the MSI