Windows 7 C# 上已安装的更新列表

发布于 2024-08-23 23:33:37 字数 263 浏览 3 评论 0原文

通过 Microsoft Ultimate Wisdom,他们更改了注册表中的更新位置。我可以毫无问题地从 Windows 2003 Server 获取更新。只是 Windows 7 已不再流行:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall

任何人都可以通过其他方式获得它。最好用 C# 或使用 WMI?

上帝用他们的智慧拯救微软

With Microsoft Ultimate Wisdom they have changed the location of updates from Registry. I can get the updates from Windows 2003 Servers no problem. Its just that Windows 7 is no longer in:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall

Any body got any other ways to get it. Preferably in C# or using WMI?

God Save Microsoft with their Wisdom

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

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

发布评论

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

评论(2

终难遇 2024-08-30 23:33:37

对于 Window 7 64 位,它位于 HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Updates 中

For Window 7 64-bit it's in HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Updates

一百个冬季 2024-08-30 23:33:37
private string GetX64Installedsoftware()
{
    string Software = null;
    string SoftwareKey = @"SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall";

    Software += "\r\nWINDOWS X64 Software\r\n\r\n\r\n ";
    using (RegistryKey rk = Registry.LocalMachine.OpenSubKey(SoftwareKey))
    {
        if (rk == null)
        {
            return Software;
        }
        foreach (string skName in rk.GetSubKeyNames())
        {
            using (RegistryKey sk = rk.OpenSubKey(skName))
            {
                try
                {
                    if (!(sk.GetValue("DisplayName") == null))
                    {
                        if (sk.GetValue("InstallLocation") == null)
                            Software += sk.GetValue("DisplayName") + " - Install path not known \r\n ";
                        else
                            Software += sk.GetValue("DisplayName") + " - " + sk.GetValue("InstallLocation") + "\r\n ";
                    }
                }
                catch (Exception ex)
                {
                }
            }
        }
    }
    return Software;
}
private string GetX64Installedsoftware()
{
    string Software = null;
    string SoftwareKey = @"SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall";

    Software += "\r\nWINDOWS X64 Software\r\n\r\n\r\n ";
    using (RegistryKey rk = Registry.LocalMachine.OpenSubKey(SoftwareKey))
    {
        if (rk == null)
        {
            return Software;
        }
        foreach (string skName in rk.GetSubKeyNames())
        {
            using (RegistryKey sk = rk.OpenSubKey(skName))
            {
                try
                {
                    if (!(sk.GetValue("DisplayName") == null))
                    {
                        if (sk.GetValue("InstallLocation") == null)
                            Software += sk.GetValue("DisplayName") + " - Install path not known \r\n ";
                        else
                            Software += sk.GetValue("DisplayName") + " - " + sk.GetValue("InstallLocation") + "\r\n ";
                    }
                }
                catch (Exception ex)
                {
                }
            }
        }
    }
    return Software;
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文