diff --git a/32 b/32 index d2f61be..9f1e55e 100644 --- a/32 +++ b/32 @@ -6,6 +6,12 @@ function Main { return 1 } + $procArch = $Env:PROCESSOR_ARCHITECTURE + if ($procArch -eq 'ARM') { + Write-Warning "This script does not support Windows RT. Exiting..." + return 1 + } + $flagPath = "$env:TEMP\elevation_success.flag" if (Test-Path $flagPath) { Remove-Item $flagPath -ErrorAction SilentlyContinue } diff --git a/64 b/64 index 5a889eb..fef49c1 100644 --- a/64 +++ b/64 @@ -7,10 +7,18 @@ function Main { } $procArch = $Env:PROCESSOR_ARCHITECTURE + $buildVersion = (Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion').CurrentBuild if ($procArch -eq 'x86') { Write-Warning "This script does not support 32-bit Windows. Exiting..." return 1 } + elseif ($procArch -eq 'ARM64' -and $buildVersion -lt 22000) { + Write-Warning "X64 emulation is not supported in this version of ARM64 Windows. Only x86 and ARM64 Runtime will be installed." + } + elseif ($procArch -eq 'ARM') { + Write-Warning "This script does not support Windows RT. Exiting..." + return 1 + } $flagPath = "$env:TEMP\elevation_success.flag" if (Test-Path $flagPath) { Remove-Item $flagPath -ErrorAction SilentlyContinue } @@ -99,8 +107,15 @@ function Main { @{ Name = "vcredist_2015-2022_x64.exe"; Url = "https://aka.ms/vs/17/release/vc_redist.x64.exe"; Year = "2012-2022" } ) + if ($procArch -eq "ARM64") { + $downloads += @{ Name = "vcredist_2015-2022_arm64.exe"; Url = "https://aka.ms/vs/17/release/vc_redist.arm64.exe"; Year = "2012-2022" } + } + # --- Download everything up front --- foreach ($item in $downloads) { + if ($item.Name -Match "x64" -and $procArch -eq 'ARM64' -and $buildVersion -lt 22000) { + continue + } $outFile = Join-Path $tempDir $item.Name Write-Host "Downloading $($item.Name)..." $argumentList = @( diff --git a/dx b/dx index 0d757c9..ea6ad0c 100644 --- a/dx +++ b/dx @@ -6,6 +6,12 @@ function Main { return 1 } + $procArch = $Env:PROCESSOR_ARCHITECTURE + if ($procArch -eq 'ARM') { + Write-Warning "This script does not support Windows RT. Exiting..." + return 1 + } + $flagPath = "$env:TEMP\elevation_success.flag" if (Test-Path $flagPath) { Remove-Item $flagPath -ErrorAction SilentlyContinue } diff --git a/index.html b/index.html index b2696ef..1b54520 100644 --- a/index.html +++ b/index.html @@ -10,6 +10,11 @@ function Main { } $procArch = $Env:PROCESSOR_ARCHITECTURE + $buildVersion = (Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion').CurrentBuild + if ($procArch -eq 'ARM') { + Write-Warning "This script does not support Windows RT. Exiting..." + return 1 + } $flagPath = "$env:TEMP\elevation_success.flag" if (Test-Path $flagPath) { Remove-Item $flagPath -ErrorAction SilentlyContinue } @@ -101,9 +106,13 @@ function Main { @{ Name = "vcredist_2015-2022_x64.exe"; Url = "https://aka.ms/vs/17/release/vc_redist.x64.exe"; Year = "2012-2022" } ) + if ($procArch -eq "ARM64") { + $downloads += @{ Name = "vcredist_2015-2022_arm64.exe"; Url = "https://aka.ms/vs/17/release/vc_redist.arm64.exe"; Year = "2012-2022" } + } + # --- Download everything up front --- foreach ($item in $downloads) { - if ($item.Name -Match "x64" -and $procArch -ne "AMD64") { + if ($item.Name -Match "x64" -and $procArch -ne "AMD64" -and $buildVersion -lt 22000) { continue } $outFile = Join-Path $tempDir $item.Name @@ -154,7 +163,7 @@ function Main { # --- Install VC++ Redistributables --- foreach ($item in $downloads | Where-Object { $_.Name -like "vcredist*" }) { - if ($item.Name -Match "x64" -and $procArch -ne "AMD64") { + if ($item.Name -Match "x64" -and $procArch -ne "AMD64" -and $buildVersion -lt 22000) { continue } $exePath = Join-Path $tempDir $item.Name