通过 WMI 或 Powershell 远程获取应用程序的 Windows Installer 补丁

通过 WMI 或 Powershell 远程获取应用程序的 Windows Installer 补丁

我正在开发一款远程管理应用,需要能够获取已应用于应用程序的补丁列表。这篇支持文章建议有两种存储方法:

https://support.microsoft.com/en-us/kb/888535
通过 Update.exe 安装的更新可以从注册表中轻松获取。

但是,使用 Windows Installer 安装的补丁保存在 MSI 和 MSU(?) 文件中。我可以通过使用应用程序的 GUID 调用 Windows Installer 方法 MsiEnumPatches 在本地读取它们。

但是,我需要远程执行此操作。我在目标计算机上有一个管理员帐户。对于其他进程,我可以使用 Win32_* 类型和 WMI 远程访问功能。但是,Windows Installer 的 WMI 接口中似乎没有等效功能。

API 类提供https://msdn.microsoft.com/en-us/library/windows/desktop/aa394523
似乎没有任何东西能让我获得针对特定应用程序应用的补丁列表。

有人能给我指明正确的方向吗?运行 msiexec.exe 作为远程命令是可能的,但 CLI 交换机似乎没有提供所需的功能。

答案1

您可以使用事件查看器吗?您也可以使用 get-winevent

This is using Get-CimInstance -ClassName Win32_NTLogEvent

Category         : 1
CategoryString   : Windows Update Agent
EventCode        : 43
EventIdentifier  : 43
TypeEvent        : 
InsertionStrings : {Update for Windows 8.1 for x64-based Systems    (KB3118401), {a9405868-c0fb-44dd-b13b-ab595d85d6df}, 201}
LogFile          : System
Message          : Installation Started: Windows has started installing the following update: Update for Windows 8.1 for x64-based Systems (KB3118401)
RecordNumber     : 17648
SourceName       : Microsoft-Windows-WindowsUpdateClient
TimeGenerated    : 13/03/2016 4:31:09 PM
TimeWritten      : 13/03/2016 4:31:09 PM
Type             : Information
UserName         : 

相关内容