windows - 如何使用 PowerShell 获取所有已安装的 Windows 更新名称和 KB 编号?
问题描述
我需要使用 PowerShell 获取所有已安装的 Windows 更新。
结果应包含更新名称、KB 编号、CVE id 和严重性等级。我尝试了下一个脚本:
Get-HotFix
,
wmic qfe list
,
Get-WmiObject -Class Win32_QuickFixEngineering
. 但它只返回 KB 数字。我还尝试从下一个脚本结果过滤安装更新:
Get-ChildItem -Path 'Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages'
. 但此脚本并非返回所有更新。
下一个脚本也不会返回所有已安装的 Windows 更新:
$Searcher = $Session.CreateUpdateSearcher()
$HistoryCount = $Searcher.GetTotalHistoryCount()
$Updates = $Searcher.Search("IsPresent=1").Updates
$Updates | ForEach-Object {$_}
我没有更多的想法,我将不胜感激。
解决方案
查看 PowerShell 库中的PSWindowsUpdate模块。此模块中的Get-WUHistory
cmdlet 可能包含您需要的一切。
推荐阅读
- reactjs - 使用 TypeScript 设置 React 组件的状态类型
- html - 如何获取可折叠面板边框上的文本
- firebase - 颤振 firebase_messaging
- python-3.x - 用于预览 opencv 更改的 GUI 界面
- python - Python中二十一点的甲板类
- vue.js - 在 vuejs 中使用 prepend 重定向路由
- elasticsearch - 限制弹性搜索响应中的列文本长度
- shell - 如何使用awk根据前两个字段找出第三个字段的最大值
- python - 如何在python3.6中用pytest测试两个json文件
- flutter - Fluter json解码FormatException中的Getiing异常:输入意外结束(在字符5处)