From 0ef7ffd4ac0f56c7e18f7dbccac70090513845bf Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Fri, 12 Apr 2024 06:23:45 +0200 Subject: [PATCH] Provisioning: Add Get-CpuArchitecture helper function For the addition of ARM64 to our checked packages, this helper function will come in handy as it is more fine grained than Is64BitHost. Change-Id: I8956c1ca6e445c0b783a39e4d42069199496f053 Reviewed-by: Heikki Halmet (cherry picked from commit 8fae627f8b6440c900544fc76d2e68735496c2e8) --- coin/provisioning/common/windows/helpers.ps1 | 22 ++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/coin/provisioning/common/windows/helpers.ps1 b/coin/provisioning/common/windows/helpers.ps1 index fa7c9ce5..9fbf27aa 100644 --- a/coin/provisioning/common/windows/helpers.ps1 +++ b/coin/provisioning/common/windows/helpers.ps1 @@ -196,6 +196,28 @@ function Is64BitWinHost return [environment]::Is64BitOperatingSystem } +enum CpuArch { + x64 + x86 + arm64 + unknown +} + +function Get-CpuArchitecture +{ + # Possible values are "AMD64", "IA64", "ARM64", and "x86" + $arch = [System.Environment]::GetEnvironmentVariable('PROCESSOR_ARCHITECTURE', 'Machine') + if ($arch -eq "AMD64") { + return [CpuArch]::x64 + } elseif ($arch -eq "x86") { + return [CpuArch]::x86 + } elseif ($arch -eq "ARM64") { + return [CpuArch]::arm64 + } + + return [CpuArch]::unknown +} + function IsProxyEnabled { return (Get-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings').proxyEnable }