2010-08-05 77 views

回答

2

終於明白了。使用VBScript自定義操作。

Dim myUpgradeCode 
myUpgradeCode = "{6EFB1553-7F4F-4E26-A32B-E2F0F8E11CA9}" 

Dim justMe 
justMe = False 

'AssignmentType 
' Equals 0 if product is advertised or installed per-user. 
' Equals 1 if product is advertised or installed per-machine for all users. 

Set products = Session.Installer.RelatedProducts(myUpgradeCode) 
For Each product In products 
    astp = CLng(Session.Installer.ProductInfo(product, "AssignmentType")) 
    If astp = 0 Then 
     justMe = True 
    End If 
Next 

If JustMe Then 
    Session.Property("ALLUSERS") = "" 
Else 
    Session.Property("ALLUSERS") = "1" 
End If 

並在AppSearch之前執行它。

完成!

0

在安裝過程中,您可以將ALLUSERS MSI屬性的值保存到註冊表中的明確位置。然後,您可以在升級並相應採取行動時查詢該值。

您也可以使用MSI API來檢查您的產品是按照每臺機器還是每個用戶的環境安裝的。爲此,您可以調用MsiEnumProductsEx函數,並查看您的產品是否出現在任一安裝上下文中。

+0

好吧..得到它在Custom Action VBScript中工作。但即使我將ALLUSERS設置爲「{}」,也會爲所有用戶安裝。爲什麼? 自定義操作在「LaunchConditions」之前執行。它會將ALLUSERS設置爲「{}」或「1」。 – Trainee4Life 2010-08-05 14:32:59

相關問題