因此,WindowsInstaller会为安装的软件包提供任何ID,例如:673538CFB3FFAAC4380E12843BBFC789或BA342DECAB7C24D3699041FEA5F66C10等。如何通过已知安装包找到此ID?Windows安装程序ID的
1
A
回答
0
下面是一个示例VBScript,它从任何给定的MSI文件中提取各种有用的属性,而无需安装它。您可以使用工具手动打开给定的包,如Orca
或者,如果你正在寻找识别当前已安装的软件包,可以使用Windows Installer API重复安装的项目,或者在命令行中使用msiinv.exe
Option Explicit
Dim argCount:argCount = Wscript.Arguments.Count
Dim sPackageCode, sProductCode, sProductVersion, sDownloadURL, sConfig, sProductName
If (argCount = 0) Then
WScript.Echo "Usage: msiinfo.vbs <filename>"
WScript.Quit 1
End If
Dim MSI_FILE : MSI_FILE = Wscript.Arguments(0)
Dim filesys : Set filesys=CreateObject("Scripting.FileSystemObject")
If Not filesys.FileExists(MSI_FILE) Then
WScript.Echo "Unable to find " & MSI_FILE & ", exiting"
WScript.Quit 1
End If
Dim installer, database, view, result
Set installer = CreateObject("WindowsInstaller.Installer")
Set database = installer.OpenDatabase (MSI_FILE, 0)
Dim sumInfo : Set sumInfo = installer.SummaryInformation(MSI_FILE, 0)
sPackageCode = sumInfo.Property(9) ' PID_REVNUMBER = 9, contains the package code.
Dim sDetails : sDetails = "ProductVersion: " & getproperty("ProductVersion") & vbCrLf _
& "ProductCode: " & getproperty("ProductCode") & vbCrLf _
& "PackageCode: " & sPackageCode & vbCrLf _
& "ProductName: " & getproperty("ProductName")
WScript.Echo sDetails
Function getproperty(property)
Set view = database.OpenView ("SELECT Value FROM Property WHERE Property='" & property & "'")
view.Execute
Set result = view.Fetch
getproperty = result.StringData(1)
End Function
0
如果你喜欢使用PowerShell:
$winInstaller = New-Object -ComObject WindowsInstaller.Installer
$msiInstalledApps = @()
foreach($item in $winInstaller.GetType().InvokeMember("Products","GetProperty",$null, $winInstaller, $null)){
$msiInstalledApps += New-Object PSObject -Property ($hash = [ordered]@{
Language = $winInstaller.GetType().InvokeMember("ProductInfo","GetProperty",$null, $winInstaller, @($item, "Language"))
ProductName = $winInstaller.GetType().InvokeMember("ProductInfo","GetProperty",$null, $winInstaller, @($item, "ProductName"))
PackageCode = $winInstaller.GetType().InvokeMember("ProductInfo","GetProperty",$null, $winInstaller, @($item, "PackageCode"))
Transforms = $winInstaller.GetType().InvokeMember("ProductInfo","GetProperty",$null, $winInstaller, @($item, "Transforms"))
AssignmentType = $winInstaller.GetType().InvokeMember("ProductInfo","GetProperty",$null, $winInstaller, @($item, "AssignmentType"))
PackageName = $winInstaller.GetType().InvokeMember("ProductInfo","GetProperty",$null, $winInstaller, @($item, "PackageName"))
InstalledProductName = $winInstaller.GetType().InvokeMember("ProductInfo","GetProperty",$null, $winInstaller, @($item, "InstalledProductName"))
VersionString = $winInstaller.GetType().InvokeMember("ProductInfo","GetProperty",$null, $winInstaller, @($item, "VersionString"))
RegCompany = $winInstaller.GetType().InvokeMember("ProductInfo","GetProperty",$null, $winInstaller, @($item, "RegCompany"))
RegOwner = $winInstaller.GetType().InvokeMember("ProductInfo","GetProperty",$null, $winInstaller, @($item, "RegOwner"))
ProductID = $winInstaller.GetType().InvokeMember("ProductInfo","GetProperty",$null, $winInstaller, @($item, "ProductID"))
ProductIcon = $winInstaller.GetType().InvokeMember("ProductInfo","GetProperty",$null, $winInstaller, @($item, "ProductIcon"))
InstallLocation = $winInstaller.GetType().InvokeMember("ProductInfo","GetProperty",$null, $winInstaller, @($item, "InstallLocation"))
InstallSource = $winInstaller.GetType().InvokeMember("ProductInfo","GetProperty",$null, $winInstaller, @($item, "InstallSource"))
InstallDate = $winInstaller.GetType().InvokeMember("ProductInfo","GetProperty",$null, $winInstaller, @($item, "InstallDate"))
Publisher = $winInstaller.GetType().InvokeMember("ProductInfo","GetProperty",$null, $winInstaller, @($item, "Publisher"))
LocalPackage = $winInstaller.GetType().InvokeMember("ProductInfo","GetProperty",$null, $winInstaller, @($item, "LocalPackage"))
HelpLink = $winInstaller.GetType().InvokeMember("ProductInfo","GetProperty",$null, $winInstaller, @($item, "HelpLink"))
HelpTelephone = $winInstaller.GetType().InvokeMember("ProductInfo","GetProperty",$null, $winInstaller, @($item, "HelpTelephone"))
URLInfoAbout = $winInstaller.GetType().InvokeMember("ProductInfo","GetProperty",$null, $winInstaller, @($item, "URLInfoAbout"))
URLUpdateInfo = $winInstaller.GetType().InvokeMember("ProductInfo","GetProperty",$null, $winInstaller, @($item, "URLUpdateInfo"))
})
}
$msiInstalledApps
相关问题
- 1. Windows安装程序
- 2. Windows的安装程序
- 3. 使用msi安装程序的安装程序windows服务
- 4. 创建Windows安装程序
- 5. 模拟Windows安装程序
- 6. Windows安装程序XML(WiX)
- 7. Windows服务安装程序
- 8. Windows安装程序包
- 9. Windows安装程序msi包
- 10. Windows安装程序问题
- 11. 未安装应用程序安装程序ID
- 12. 使用Windows安装程序向GAC安装程序集
- 13. 维克斯/ Windows安装程序:安装顺序文档
- 14. 免费的Windows安装程序
- 15. Windows安装程序包的问题
- 16. 在windows中安装firefox exetension的程序?
- 17. Windows 7上的RubyMine 3.0安装程序
- 18. COM组件的Windows安装程序
- 19. 在Windows 7上的python安装程序
- 20. Windows安装程序的默认安装级别是什么?
- 21. 有关通过Windows安装程序安装应用程序的问题
- 22. Windows虚拟PC开发安装程序?
- 23. Windows安装程序数据库检查?
- 24. Windows安装程序 - 防止覆盖dll
- 25. Windows安装程序技术如何对
- 26. Plone 4.1 Windows安装程序更改
- 27. C#,UAC,安装程序,Windows 7
- 28. 为Windows Mobile创建安装程序
- 29. Windows安装程序XML域对象
- 30. 检查Windows安装程序版本
这个问题似乎是类似http://stackoverflow.com/questions/2467429/c-check-installed-programms – Ciprian