2011-02-15 25 views
8

如何從msi包中提取ProductCode?我想稍後使用它通過msiexec卸載msi here如何從msi包中提取ProductCode?

+2

這是在VB腳本,但可以給一些想法:http://leereid.wordpress.com/2008/08/20/vbscript-get-msi-productcode/ – 2011-02-15 14:45:50

+1

Orca.exe是你的朋友,如果你想手動執行此操作 – 2011-02-15 14:54:13

+0

另請參閱http://stackoverflow.com/questions/113542/how-can-i-uninstall-an-application-using-powershell – 2012-04-11 16:02:49

回答

4

我可以想出幾十種方法來做到這一點。你目前使用哪些編程語言和/或舒適?

看看

Execute SQL Statements

你可以使用WiRunSQL.vbs(Platform SDK中提供)運行命令:

cscript /nologo WiRunSQL.vbs FOO.msi "SELECT Value FROM Property WHERE Property = 'ProductCode'" 
0

你可以實現做一個類似的效果基於已安裝的程序在PowerShell中執行以下操作:

Get-WmiObject -Class Win32_Product -Filter "Vendor LIKE 'The Company%' AND Name LIKE '%The Product%'" | %{ 
    Write-Host "Uninstalling $($_.IdentifyingNumber)" 
    $_.Uninstall() 
} 

(Obv查詢越嚴密,查詢速度越快 - 上面的代碼非常昂貴)

或者您可以在您的堆棧上應用the general technique in here

相關問題