dsh*_*per 11 windows windows-installer guid
如何在Windows中列出已安装程序的GUID?或者,如果我有MSI文件,是否更容易找到GUID?
我正在通过Orca查看MSI文件,但不确定在哪里查找GUID.
谢谢!
Mic*_*man 13
Windows Installer数据库的三个主要GUID是Package Code,ProductCode和UpgradeCode.第一个存储在摘要信息流(Orca中的View菜单)中,其他存储在Property表中.(其他形式的数据库,例如合并模块和补丁在类似的地方具有类似的GUID,例如合并模块的GUID或补丁代码GUID - 每个都与包代码相同地存储.)
要在计算机上查找它们,可以查看经常使用ProductCode的Uninstall键.或者更好的是,如果您想要枚举机器上当前安装的内容,可以调用MsiEnumProducts.
有几种方法可以查找产品GUID进行安装的软件包.请选择3号选项.
最常见的是:
- 32-BIT SECTION:
HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall
HKCU\Software\Microsoft\Windows\CurrentVersion\Uninstall (per user section)
Run Code Online (Sandbox Code Playgroud)
- 64-BIT SECTION:
HKLM\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall
Run Code Online (Sandbox Code Playgroud)
- MERGED SECTION (supposedly all of the above merged together, I have not verified):
HKCR\Installer\Products
Run Code Online (Sandbox Code Playgroud)
如果你要做的是卸载有问题的产品,请参阅此comprehesive卸载MSI答案:从命令行卸载MSI文件而不使用msiexec
如果您觉得使用VBScript而不是Powershell 更舒服,请尝试Phil Wilson的答案:如何找出安装了哪些产品 - 已经安装了更新的产品MSI windows
如果您只想知道给定 MSI 包含的 ProductName 和 ProductCode (ProductId),而不安装该 MSI 并检查注册表,您可以使用 PowerShell 使用这样的函数查询 MSI 本身(灵感来自http://www.scconfigmgr .com/2014/08/22/how-to-get-msi-file-information-with-powershell):
function Get-MSIProperties {
param (
[Parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
[System.IO.FileInfo] $path,
[string[]] $properties = @('ProductCode', 'ProductVersion', 'ProductName', 'Manufacturer', 'ProductLanguage')
)
begin {
$windowsInstaller = (New-Object -ComObject WindowsInstaller.Installer)
}
process {
$table = @{}
$msi = $windowsInstaller.GetType().InvokeMember('OpenDatabase', 'InvokeMethod', $null, $windowsInstaller, @($Path.FullName, 0))
foreach ($property in $properties) {
try {
$view = $msi.GetType().InvokeMember('OpenView', 'InvokeMethod', $null, $msi, ("SELECT Value FROM Property WHERE Property = '$($property)'"))
$view.GetType().InvokeMember('Execute', 'InvokeMethod', $null, $view, $null)
$record = $view.GetType().InvokeMember('Fetch', 'InvokeMethod', $null, $view, $null)
$table.add($property, $record.GetType().InvokeMember('StringData', 'GetProperty', $null, $record, 1))
}
catch {
$table.add($property, $null)
}
}
$msi.GetType().InvokeMember('Commit', 'InvokeMethod', $null, $msi, $null)
$view.GetType().InvokeMember('Close', 'InvokeMethod', $null, $view, $null)
$msi = $null
$view = $null
return $table
}
end {
[System.Runtime.Interopservices.Marshal]::ReleaseComObject($windowsInstaller) | Out-Null
[System.GC]::Collect()
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
45890 次 |
| 最近记录: |