我試圖讓這段代碼正常工作,但我無法獲得匹配的版本 - 你能幫忙嗎?Powershell檢查已安裝程序的版本號
$Version = Get-ChildItem hklm:\software\microsoft\windows\currentversion\uninstall | ForEach-Object {Get-ItemProperty $_.pspath} | Where-Object {
$_.PSChildName -Eq '{BFAE8D5B-F918-486F-B74E-90762DF11C5C}'} | Select-Object Version
Write-Host $Version
if ($Version -eq 67436760)
{
Write-Host "Version match"
}
else
{
Write-Host "Not Matched"
}
你可以在**簡單地添加 - ExpandProperty **轉換爲'選擇-對象-Version',爲了回報**版本的內容**,而不是包含一個對象的屬性屬性。對於這個屬性的幫助還不清楚,但是我剛剛發佈了[解釋差異的另一個問題的答案](http://stackoverflow.com/a/24535790/1248365)......我剛剛注意到了一個不準確的問題,但我會立即修復。 –