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 <heikki.halmet@qt.io>
This commit is contained in:
Oliver Wolff 2024-04-12 06:23:45 +02:00
parent 0477a26495
commit 8fae627f8b
1 changed files with 22 additions and 0 deletions

View File

@ -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
}