将产品代码传递给MSI:系统策略禁止此安装

本文关键字:系统 策略 禁止 安装 MSI 代码 | 更新日期: 2023-09-27 18:05:13

我正在尝试对已安装的应用程序(该应用程序在机器上安装了多次)应用更新。因为我知道实例的ProductCode,所以我在更新时将它传递给.msi。

从代码来看,这相当于:

// Leaving out my set of global parameters (for brevity), instance is first (:I1)
Installer.InstallProduct("FullNameOfMsiFile", @"MSIINSTANCEGUID={GUISDF-F5FD-4333-9D02-F0B72E048AB6} TRANSFORMS="":I1"""); 

当我尝试这个时,我得到一个InstallerException告诉我"这个安装是被系统策略禁止的。"请与系统管理员联系"。调用。msi的程序具有更高的权限,如果没有传递产品代码,可以很好地安装/更新程序。

当我试图在命令行上传递ProductCode(用/n传递ProductCode)时也会发生这种情况。没有ProductCode,安装/更新工作得很好,所以我认为这就是问题所在。

我从互联网上尝试了几种建议的解决方案,如转动UCA或寻找某种注册表项并更改它,但没有成功。

那么,为什么windows (win7 32位)明确禁止我通过产品代码,是否有一个简单的方法来解决这个问题?

在任何情况下,如果这只能在用户手动更改一些设置后工作,那么我的好安装程序有一个严重的问题,因为它意味着安装/更新没有任何麻烦。

编辑回答taffit的问题:

更新是一个主要的升级,为每个实例生成一个新的ProductCode,通过WIX代码,所以每个实例都有自己的升级代码(这是唯一的实例):

<Property Id="InstanceId" Value="Default"/>
<InstanceTransforms Property="InstanceId">
  <Instance Id="I1" ProductCode="*" UpgradeCode="{GUID-2B92-407D-A609-C8DD9A0CF09C}" />
  <Instance Id="I2" ProductCode="*" UpgradeCode="{GUID-85B4-4C68-B687-EBE02F282C2D}" />
<!-- further possible instances here, removed for brevity -->
</InstanceTransforms>

为每个实例存储产品代码,因此在尝试升级时,我知道为实例传递哪个产品代码。

编辑编号2:

事件日志不是很有趣,它只有三个事件属于不工作的升级(一个是msi启动,一个恢复点被创建,然后一个安装事务被停止,但没有说为什么)

.msi的日志停止并显示错误码1625,这意味着系统策略拒绝安装。我真的不知道这些政策是什么,也不知道该怎么做。

MSI (c) (78:84) [08:51:46:479]: Machine policy value 'DisableUserInstalls' is 0
MSI (c) (78:84) [08:51:46:530]: Client-side and UI is none or basic: Running entire     install on the server.
MSI (c) (78:84) [08:51:46:570]: Grabbed execution mutex.
MSI (c) (78:84) [08:51:47:083]: Cloaking enabled.
MSI (c) (78:84) [08:51:47:120]: Attempting to enable all disabled privileges before     calling Install on Server
MSI (c) (78:84) [08:51:47:170]: Incrementing counter to disable shutdown. Counter after increment: 0
MSI (s) (B4:4C) [08:51:47:248]: Running installation inside multi-package transaction    C:'Program Files'MyProgram'installer.msi
MSI (s) (B4:4C) [08:51:47:295]: Grabbed execution mutex.
MSI (s) (B4:A8) [08:51:47:340]: Resetting cached policy values
MSI (s) (B4:A8) [08:51:47:368]: Machine policy value 'Debug' is 0
MSI (s) (B4:A8) [08:51:47:403]: ******* RunEngine:
       ******* Product: C:'Program Files'MyProgram'installer.msi
       ******* Action: 
       ******* CommandLine: **********
MSI (s) (B4:A8) [08:51:47:453]: Machine policy value 'DisableUserInstalls' is 0
MSI (s) (B4:A8) [08:51:47:498]: Machine policy value 'LimitSystemRestoreCheckpointing' is 0
MSI (s) (B4:A8) [08:51:47:561]: Note: 1: 1715 2: MyProgram 
MSI (s) (B4:A8) [08:51:47:620]: Calling SRSetRestorePoint API. dwRestorePtType: 0,  dwEventType: 102, llSequenceNumber: 0, szDescription: "MyProgram wird installiert".
MSI (s) (B4:A8) [08:52:07:257]: The call to SRSetRestorePoint API succeeded. Returned status: 0, llSequenceNumber: 14.
MSI (s) (B4:A8) [08:52:07:497]: MainEngineThread is returning 1625
MSI (s) (B4:4C) [08:52:07:587]: Calling SRSetRestorePoint API. dwRestorePtType: 13, dwEventType: 103, llSequenceNumber: 14, szDescription: "".
MSI (s) (B4:4C) [08:52:07:763]: The call to SRSetRestorePoint API succeeded. Returned status: 0.
MSI (s) (B4:4C) [08:52:07:863]: User policy value 'DisableRollback' is 0
MSI (s) (B4:4C) [08:52:07:944]: Machine policy value 'DisableRollback' is 0
MSI (s) (B4:4C) [08:52:08:045]: Incrementing counter to disable shutdown. Counter after increment: 0
MSI (s) (B4:4C) [08:52:08:195]: Note: 1: 1402 2:    HKEY_LOCAL_MACHINE'Software'Microsoft'Windows'CurrentVersion'Installer'Rollback'Scripts 3:   2 
MSI (s) (B4:4C) [08:52:08:262]: Note: 1: 1402 2: HKEY_LOCAL_MACHINE'Software'Microsoft'Windows'CurrentVersion'Installer'Rollback'Scripts 3: 2 
MSI (s) (B4:4C) [08:52:08:330]: Note: 1: 1402 2:  HKEY_LOCAL_MACHINE'Software'Microsoft'Windows'CurrentVersion'Installer'InProgress 3: 2 
MSI (s) (B4:4C) [08:52:08:443]: Note: 1: 1402 2: HKEY_LOCAL_MACHINE'Software'Microsoft'Windows'CurrentVersion'Installer'InProgress 3: 2 
MSI (s) (B4:4C) [08:52:08:627]: Decrementing counter to disable shutdown. If counter >= 0, shutdown will be denied.  Counter after decrement: -1
MSI (s) (B4:4C) [08:52:08:720]: Restoring environment variables
MSI (c) (78:84) [08:52:08:871]: Decrementing counter to disable shutdown. If counter >= 0, shutdown will be denied.  Counter after decrement: -1
MSI (c) (78:84) [08:52:08:936]: MainEngineThread is returning 1625
=== Verbose logging stopped: 28.05.2014  08:52:09 ===

将产品代码传递给MSI:系统策略禁止此安装

试着从Installshield用户社区阅读这个旧线程:http://community.flexerasoftware.com/archive/index.php?t-169856.html或这个讨论:更新

实例转换错误