如何使用WMI查询的方式获取安装的软件列表:
Get-WmiObjectwin32_product
- ‘HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall’
- ‘HKCU:\Software\Microsoft\Windows\CurrentVersion\Uninstall’
- ‘HKLM:SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall’
第一个表示的是机器级别的软件。
第二个表示仅限当前用户安装的软件(ClickOne程序默认可以从这个路径下查询)。
第三个和第一个类似,只是只可能出现在64位操作系统上。
具体的调用函数可以参考:
也可以直接在控制台调用:
Invoke-Expression (new-object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/Benson80/PSTips/master/Functions/Get-InstalledSoftwares.ps1')
Get-InstalledSoftwares