查看已安装软件
1.通过注册列表查看
$Path=@('HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*','HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*','HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*','HKCU:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*')$Items=Get-ItemProperty -Path $Path -ErrorAction SilentlyContinue
2.关键字,查找相应软件
$officeList=$Items|Select-object -Property DisplayName,DisplayVersion,UninstallString |Where-Object DisplayName -like "*office*"|Where-Object DisplayName -like "*click-to*"
a.使用Select-object -Property 获取需要的属性
b.使用Where-Object xxx -like 来模糊匹配关键字
参考:https://www.kentonhu.com/?p=1831