diff --git a/lib/core/icingaagent/getters/Get-IcingaAgentInstallation.psm1 b/lib/core/icingaagent/getters/Get-IcingaAgentInstallation.psm1 index dad4888c..5a02599e 100644 --- a/lib/core/icingaagent/getters/Get-IcingaAgentInstallation.psm1 +++ b/lib/core/icingaagent/getters/Get-IcingaAgentInstallation.psm1 @@ -1,12 +1,12 @@ function Get-IcingaAgentInstallation() { [string]$architecture = ''; - if ([IntPtr]::Size -eq 4) { - $architecture = "x86"; - $regPath = 'HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*'; - } else { + if (Test-Path 'Env:ProgramFiles(x86)') { $architecture = "x86_64"; $regPath = @('HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*', 'HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*'); + } else { + $architecture = "x86"; + $regPath = 'HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*'; } $RegistryData = Get-ItemProperty $regPath; diff --git a/lib/core/repository/Get-IcingaRepositoryPackage.psm1 b/lib/core/repository/Get-IcingaRepositoryPackage.psm1 index 5e7fc898..623dc98c 100644 --- a/lib/core/repository/Get-IcingaRepositoryPackage.psm1 +++ b/lib/core/repository/Get-IcingaRepositoryPackage.psm1 @@ -33,7 +33,7 @@ function Get-IcingaRepositoryPackage() $SourceRepo = $null; $RepoName = $null; [bool]$HasRepo = $FALSE; - [bool]$Isx86 = [bool]([IntPtr]::Size -eq 4); + [bool]$Isx86 = [bool](-not (Test-Path 'Env:ProgramFiles(x86)')); foreach ($entry in $Repositories) { $RepoContent = Read-IcingaRepositoryFile -Name $entry.Name;