C# 代码查找所有已安装的 Office 更新

发布于 2024-10-09 07:11:16 字数 430 浏览 0 评论 0原文

在添加或删除程序中,您可以查看 MS Office Outlook 的更新/补丁列表。有没有办法使用 C# 代码获取此信息。我们尝试了 WMI 代码

const string query = "SELECT HotFixID FROM Win32_QuickFixEngineering";
var search = new ManagementObjectSearcher(query);
var collection = search.Get();

foreach (ManagementObject quickFix in collection)
    Console.WriteLine(quickFix["HotFixID"].ToString()); 

这仅列出了 Windows 更新。有没有办法列出 Office 组件的更新?(适用于 Windows XP)

In add or remove programs you can view list of updates/patches for MS office Outlook. Is there a way to get this information using c# code. We tried WMI code

const string query = "SELECT HotFixID FROM Win32_QuickFixEngineering";
var search = new ManagementObjectSearcher(query);
var collection = search.Get();

foreach (ManagementObject quickFix in collection)
    Console.WriteLine(quickFix["HotFixID"].ToString()); 

This only lists windows updates. Is there a way to list updates for office components?(for windows XP)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

ぶ宁プ宁ぶ 2024-10-16 07:11:16

我相信您将必须使用注册表来获取这些。以下注册表项应该有所帮助:

@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall",
@“SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall”

您必须循环遍历 HKLMHKCU 配置单元的值,以确保您拥有一切。然后,您可以对每个条目的 DisplayNamePublisher 进行过滤,以便仅获取 MS Office 补丁。

注意您还可以尝试查询Win32_Product 类获取 Windows 安装程序安装的产品。尽管我经常发现它没有列出您需要的所有内容(但是它可能足以解决您当前的问题 - 但我现在无法检查)。

I believe you will have to use the registry to get these. The following registry keys should help:

@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall",
@"SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall"

You will have to loop though both the values for the HKLM and HKCU hives in order to be sure you have everything. Then you can filter on DisplayName and Publisher for each entry in order to get only the MS office patches.

Note you could also try to query the Win32_Product class to get products installed by the Windows installer. Although I have often found that it does not list everything you need (however it might be sufficient for your current problem - but I am not in a position to check right now).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文