【问题标题】:Wuapi.dll Search() not returning all updatesWuapi.dll Search() 未返回所有更新
【发布时间】:2021-05-07 09:21:23
【问题描述】:

测试 wuapi.dll 的功能我注意到有些更新没有在结果中列出(显然是因为它们在更新管理器中是可见的)。

使用的代码(c#):

        public ISearchResult CheckUpdates()
        {
          IUpdateSearcher uSearcher = uSession.CreateUpdateSearcher();
          uSearcher.Online = true;
          ISearchResult uResult = uSearcher.Search("Type='Software' and IsInstalled=0");
          return uResult;
        }

还尝试了所有可能的过滤器组合。

更新管理器截图

有人知道为什么吗? 谢谢。

【问题讨论】:

  • 取出Type='Software' 也可以看到更新
  • 已经完成...没有结果。

标签: c# windows powershell updates wuapi


【解决方案1】:

尝试添加这个:

uSearcher.ServerSelection = ServerSelection.ssOthers;
uSearcher.ServiceID = "7971f918-a847-4430-9279-4a52d1efe18d";

并像 Theo 所说的那样省略 Type='Software'

【讨论】:

  • 通过这 2 行代码找到了更多更新,但我仍然找不到系统更新。
【解决方案2】:

最后我找到了适合我的过滤器:IsInstalled = 0 And DeploymentAction=*

【讨论】:

    猜你喜欢
    • 2018-08-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-07-03
    • 1970-01-01
    • 2013-10-12
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多