mirror of
https://github.com/Icinga/icinga-powershell-framework.git
synced 2026-02-18 10:08:00 -05:00
Properly detect OS arch (not current shell arch)
[IntPtr]::Size depends on the PS exe arch, but there's also an x86 one on x64. But Env:ProgramFiles(x86) is always defined on an x64 OS. https://stackoverflow.com/a/61396489
This commit is contained in:
parent
15b464f78c
commit
e08f785608
2 changed files with 5 additions and 5 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue