/usr/lib/ruby/vendor_ruby/specinfra/backend/powershell/support/find_installed_application.ps1 is in ruby-specinfra 2.66.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | function FindInstalledApplication
{
param($appName, $appVersion)
if ((Get-WmiObject win32_operatingsystem).OSArchitecture -notmatch '64')
{
$keys= (Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*')
$possible_path= 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*'
if (Test-Path $possible_path)
{
$keys+= (Get-ItemProperty $possible_path)
}
}
else
{
$keys = (Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*','HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*')
$possible_path= 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*'
if (Test-Path $possible_path)
{
$keys+= (Get-ItemProperty $possible_path)
}
$possible_path= 'HKCU:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*'
if (Test-Path $possible_path)
{
$keys+= (Get-ItemProperty $possible_path)
}
}
if ($appVersion -eq $null) {
@($keys | Where-Object {$_.DisplayName -like $appName -or $_.PSChildName -like $appName}).Length -gt 0
}
else{
@($keys | Where-Object {$_.DisplayName -like $appName -or $_.PSChildName -like $appName } | Where-Object {$_.DisplayVersion -eq $appVersion} ).Length -gt 0
}
}
|