查看已安裝軟件
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