windows - 如何使用Powershell在控制面板中的 “view installed updates”中获取 “programs and features”列表?

标签 windows powershell scripting

尝试获取所有已安装的更新(包括第三方应用程序的更新,例如Acrobat等),方法是单击控制面板中“程序和功能”中的“查看已安装的更新”。
以下方法无济于事,可能是因为它们仅限于Microsoft/Windows:

New-Object -ComObject Microsoft.Update.Session
Get-WmiObject Win32_QuickfixEngineering
Example: I want to get KB2565063 from attached image below
谢谢

最佳答案

我发现以下选项:

$x = Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* | Where-Object { $_.DisplayName -like "*foo*" }
$y = Get-ItemProperty HKLM:\SOFTWARE\Classes\Installer\Dependencies\* | Where-Object {$_.DisplayName -like "*foo*" }
在$ x中,您具有“卸载程序”中的软件,在$ y中,您具有来自“已安装的更新”的更新。
我对此不太满意,我想知道Windows如何实际上将$ x和$ y链接在一起而不仅仅搜索名称。
也许有人可以为我们修复缺少的部分:-)
编辑
我找到了解决方案:
Get-ItemProperty HKLM:\Software\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | Where-Object { $_.ParentDisplayName -like "*foo*" }
这将返回一个对象,其中ParentDisplayName是您的程序,DisplayVersion是更新版本。

关于windows - 如何使用Powershell在控制面板中的 “view installed updates”中获取 “programs and features”列表?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64031829/

相关文章:

windows - 在 Linux 中使用 jenkins 和 electron-packager 为 windows 打包 Electron 应用程序

python - 如果父进程创建一些子进程,则 subprocess.communicate() 在 Windows 8 上挂起

syntax - powershell中的条件执行(&&和||)

linux - 当由 cron 运行时,shell 脚本中使用的环境变量在日志文件中显示为空白

c - 如何解决 Windows 中的 libatomic 问题?

c - Windows 上的内存占用

azure - 如何在 Powershell 中使用 az 命令获取 Azure 指标?

windows - Chef::Exceptions::WindowsNotAdmin:由于缺少管理员权限,无法获取安全信息

shell - 如何设置shell脚本的进程名?

LibreOffice 的 Python 宏 - 替换文本中的字符串