lib/specinfra/backend/powershell/support/find_installed_application.ps1 in specinfra-0.5.0 vs lib/specinfra/backend/powershell/support/find_installed_application.ps1 in specinfra-0.5.1
- old
+ new
@@ -1,7 +1,21 @@
function FindInstalledApplication
{
param($appName, $appVersion)
- $selectionCriteria = "(Name like '$appName' or PackageName like '$appName') and InstallState = 5"
- if ($appVersion -ne $null) { $selectionCriteria += " and version = '$appVersion'"}
- Get-WmiObject Win32_Product -filter $selectionCriteria
-}
\ No newline at end of file
+
+ if ((Get-WmiObject win32_operatingsystem).OSArchitecture -notlike '64-bit')
+ {
+ $keys= (Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*')
+ }
+ else
+ {
+ $keys = (Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*','HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*')
+ }
+
+ if ($appVersion -eq $null) {
+ $keys | Where-Object {$_.name -like $appName -or $_.PSChildName -like $appName}
+ }
+ else{
+ $keys | Where-Object {$_.name -like $appName -or $_.PSChildName -like $appName } | Where-Object {$_.DisplayVersion -eq $appVersion}
+ }
+}
+