mirror of
https://github.com/msvc-win/get.msvc.win.git
synced 2025-12-16 13:17:26 +00:00
Update install routine
This commit is contained in:
parent
a7ffeac9db
commit
ae853df86b
4 changed files with 106 additions and 68 deletions
50
32
50
32
|
|
@ -11,6 +11,10 @@ function Main {
|
||||||
Write-Warning "This script does not support Windows RT. Exiting..."
|
Write-Warning "This script does not support Windows RT. Exiting..."
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
elseif ($procArch -eq 'ia64') {
|
||||||
|
Write-Warning "This script does not support Itanium. Exiting..."
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
$flagPath = "$env:TEMP\elevation_success.flag"
|
$flagPath = "$env:TEMP\elevation_success.flag"
|
||||||
if (Test-Path $flagPath) { Remove-Item $flagPath -ErrorAction SilentlyContinue }
|
if (Test-Path $flagPath) { Remove-Item $flagPath -ErrorAction SilentlyContinue }
|
||||||
|
|
@ -93,29 +97,33 @@ function Main {
|
||||||
@{ Name = "vcredist_2015-2022_x86.exe"; Url = "https://aka.ms/vs/17/release/vc_redist.x86.exe"; Year = "2015-2022" }
|
@{ Name = "vcredist_2015-2022_x86.exe"; Url = "https://aka.ms/vs/17/release/vc_redist.x86.exe"; Year = "2015-2022" }
|
||||||
)
|
)
|
||||||
|
|
||||||
|
$ariaListPath = Join-Path $tempDir "fileList.txt"
|
||||||
|
|
||||||
# --- Download everything up front ---
|
# --- Download everything up front ---
|
||||||
foreach ($item in $downloads) {
|
foreach ($item in $downloads) {
|
||||||
$outFile = Join-Path $tempDir $item.Name
|
$line = "$($item.Url)`n out=$($item.Name)"
|
||||||
Write-Host "Downloading $($item.Name)..."
|
Add-Content -Path $ariaListPath -Value $line
|
||||||
$argumentList = @(
|
}
|
||||||
"--dir=`"$($outFile | Split-Path)`"",
|
|
||||||
"--out=`"$(Split-Path -Leaf $outFile)`"",
|
Write-Host "Downloading files..."
|
||||||
"--allow-overwrite=true",
|
$argumentList = @(
|
||||||
"--retry-wait=5",
|
"--dir=`"$($outFile | Split-Path)`"",
|
||||||
"--max-connection-per-server=8",
|
"--out=`"$(Split-Path -Leaf $outFile)`"",
|
||||||
"--split=8",
|
"--allow-overwrite=true",
|
||||||
"--min-split-size=1M",
|
"--retry-wait=5",
|
||||||
"`"$($item.Url)`""
|
"--max-connection-per-server=8",
|
||||||
)
|
"--split=8",
|
||||||
if (![string]::IsNullOrEmpty($regionalWorkaround)) {
|
"--min-split-size=1M",
|
||||||
$argumentList += $regionalWorkaround
|
"-i `"$ariaListPath`""
|
||||||
}
|
)
|
||||||
$proc = Start-Process -FilePath $aria2Exe -ArgumentList $argumentList -NoNewWindow -PassThru -Wait
|
if (![string]::IsNullOrEmpty($regionalWorkaround)) {
|
||||||
if ($proc.ExitCode -ne 0) {
|
$argumentList += $regionalWorkaround
|
||||||
Write-Warning "aria2c failed (exit code $($proc.ExitCode)). Retrying with --check-certificate=false..."
|
}
|
||||||
$argsRetry = $argumentList + "--check-certificate=false"
|
$proc = Start-Process -FilePath $aria2Exe -ArgumentList $argumentList -NoNewWindow -PassThru -Wait
|
||||||
Start-Process -FilePath $aria2Exe -ArgumentList $argsRetry -NoNewWindow -Wait
|
if ($proc.ExitCode -ne 0) {
|
||||||
}
|
Write-Warning "aria2c failed (exit code $($proc.ExitCode)). Retrying with --check-certificate=false..."
|
||||||
|
$argsRetry = $argumentList + "--check-certificate=false"
|
||||||
|
Start-Process -FilePath $aria2Exe -ArgumentList $argsRetry -NoNewWindow -Wait
|
||||||
}
|
}
|
||||||
|
|
||||||
# --- Check Signature ---
|
# --- Check Signature ---
|
||||||
|
|
|
||||||
53
64
53
64
|
|
@ -19,6 +19,10 @@ function Main {
|
||||||
Write-Warning "This script does not support Windows RT. Exiting..."
|
Write-Warning "This script does not support Windows RT. Exiting..."
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
elseif ($procArch -eq 'ia64') {
|
||||||
|
Write-Warning "This script does not support Itanium. Exiting..."
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
$flagPath = "$env:TEMP\elevation_success.flag"
|
$flagPath = "$env:TEMP\elevation_success.flag"
|
||||||
if (Test-Path $flagPath) { Remove-Item $flagPath -ErrorAction SilentlyContinue }
|
if (Test-Path $flagPath) { Remove-Item $flagPath -ErrorAction SilentlyContinue }
|
||||||
|
|
@ -111,32 +115,33 @@ function Main {
|
||||||
$downloads += @{ Name = "vcredist_2015-2022_arm64.exe"; Url = "https://aka.ms/vs/17/release/vc_redist.arm64.exe"; Year = "2012-2022" }
|
$downloads += @{ Name = "vcredist_2015-2022_arm64.exe"; Url = "https://aka.ms/vs/17/release/vc_redist.arm64.exe"; Year = "2012-2022" }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$ariaListPath = Join-Path $tempDir "fileList.txt"
|
||||||
|
|
||||||
# --- Download everything up front ---
|
# --- Download everything up front ---
|
||||||
foreach ($item in $downloads) {
|
foreach ($item in $downloads) {
|
||||||
if ($item.Name -Match "x64" -and $procArch -eq 'ARM64' -and $buildVersion -lt 22000) {
|
$line = "$($item.Url)`n out=$($item.Name)"
|
||||||
continue
|
Add-Content -Path $ariaListPath -Value $line
|
||||||
}
|
}
|
||||||
$outFile = Join-Path $tempDir $item.Name
|
|
||||||
Write-Host "Downloading $($item.Name)..."
|
Write-Host "Downloading files..."
|
||||||
$argumentList = @(
|
$argumentList = @(
|
||||||
"--dir=`"$($outFile | Split-Path)`"",
|
"--dir=`"$($outFile | Split-Path)`"",
|
||||||
"--out=`"$(Split-Path -Leaf $outFile)`"",
|
"--out=`"$(Split-Path -Leaf $outFile)`"",
|
||||||
"--allow-overwrite=true",
|
"--allow-overwrite=true",
|
||||||
"--retry-wait=5",
|
"--retry-wait=5",
|
||||||
"--max-connection-per-server=8",
|
"--max-connection-per-server=8",
|
||||||
"--split=8",
|
"--split=8",
|
||||||
"--min-split-size=1M",
|
"--min-split-size=1M",
|
||||||
"`"$($item.Url)`""
|
"-i `"$ariaListPath`""
|
||||||
)
|
)
|
||||||
if (![string]::IsNullOrEmpty($regionalWorkaround)) {
|
if (![string]::IsNullOrEmpty($regionalWorkaround)) {
|
||||||
$argumentList += $regionalWorkaround
|
$argumentList += $regionalWorkaround
|
||||||
}
|
}
|
||||||
$proc = Start-Process -FilePath $aria2Exe -ArgumentList $argumentList -NoNewWindow -PassThru -Wait
|
$proc = Start-Process -FilePath $aria2Exe -ArgumentList $argumentList -NoNewWindow -PassThru -Wait
|
||||||
if ($proc.ExitCode -ne 0) {
|
if ($proc.ExitCode -ne 0) {
|
||||||
Write-Warning "aria2c failed (exit code $($proc.ExitCode)). Retrying with --check-certificate=false..."
|
Write-Warning "aria2c failed (exit code $($proc.ExitCode)). Retrying with --check-certificate=false..."
|
||||||
$argsRetry = $argumentList + "--check-certificate=false"
|
$argsRetry = $argumentList + "--check-certificate=false"
|
||||||
Start-Process -FilePath $aria2Exe -ArgumentList $argsRetry -NoNewWindow -Wait
|
Start-Process -FilePath $aria2Exe -ArgumentList $argsRetry -NoNewWindow -Wait
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# --- Check Signature ---
|
# --- Check Signature ---
|
||||||
|
|
|
||||||
4
dx
4
dx
|
|
@ -11,6 +11,10 @@ function Main {
|
||||||
Write-Warning "This script does not support Windows RT. Exiting..."
|
Write-Warning "This script does not support Windows RT. Exiting..."
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
elseif ($procArch -eq 'ia64') {
|
||||||
|
Write-Warning "This script does not support Itanium. Exiting..."
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
$flagPath = "$env:TEMP\elevation_success.flag"
|
$flagPath = "$env:TEMP\elevation_success.flag"
|
||||||
if (Test-Path $flagPath) { Remove-Item $flagPath -ErrorAction SilentlyContinue }
|
if (Test-Path $flagPath) { Remove-Item $flagPath -ErrorAction SilentlyContinue }
|
||||||
|
|
|
||||||
67
index.html
67
index.html
|
|
@ -10,11 +10,16 @@ function Main {
|
||||||
}
|
}
|
||||||
|
|
||||||
$procArch = $Env:PROCESSOR_ARCHITECTURE
|
$procArch = $Env:PROCESSOR_ARCHITECTURE
|
||||||
|
$isServer = (Get-CimInstance Win32_OperatingSystem).ProductType -ne 1
|
||||||
$buildVersion = (Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion').CurrentBuild
|
$buildVersion = (Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion').CurrentBuild
|
||||||
if ($procArch -eq 'ARM') {
|
if ($procArch -eq 'ARM') {
|
||||||
Write-Warning "This script does not support Windows RT. Exiting..."
|
Write-Warning "This script does not support Windows RT. Exiting..."
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
elseif ($procArch -eq 'ia64') {
|
||||||
|
Write-Warning "This script does not support Itanium. Exiting..."
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
$flagPath = "$env:TEMP\elevation_success.flag"
|
$flagPath = "$env:TEMP\elevation_success.flag"
|
||||||
if (Test-Path $flagPath) { Remove-Item $flagPath -ErrorAction SilentlyContinue }
|
if (Test-Path $flagPath) { Remove-Item $flagPath -ErrorAction SilentlyContinue }
|
||||||
|
|
@ -40,6 +45,13 @@ function Main {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($isServer) {
|
||||||
|
Write-Warning "Windows Server detected, DirectX will not be installed. To install it anyway, execute following command:"
|
||||||
|
Write-Host "irm https://get.msvc.win/dx | iex"
|
||||||
|
Write-Host "This script will continue in 10 seconds..."
|
||||||
|
Start-Sleep -Seconds 10
|
||||||
|
}
|
||||||
|
|
||||||
# --- Elevated section ---
|
# --- Elevated section ---
|
||||||
New-Item -Path $flagPath -ItemType File -Force | Out-Null
|
New-Item -Path $flagPath -ItemType File -Force | Out-Null
|
||||||
Write-Host "Running with elevated privileges..."
|
Write-Host "Running with elevated privileges..."
|
||||||
|
|
@ -110,32 +122,39 @@ function Main {
|
||||||
$downloads += @{ Name = "vcredist_2015-2022_arm64.exe"; Url = "https://aka.ms/vs/17/release/vc_redist.arm64.exe"; Year = "2012-2022" }
|
$downloads += @{ Name = "vcredist_2015-2022_arm64.exe"; Url = "https://aka.ms/vs/17/release/vc_redist.arm64.exe"; Year = "2012-2022" }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$ariaListPath = Join-Path $tempDir "fileList.txt"
|
||||||
|
|
||||||
# --- Download everything up front ---
|
# --- Download everything up front ---
|
||||||
foreach ($item in $downloads) {
|
foreach ($item in $downloads) {
|
||||||
if ($item.Name -Match "x64" -and $procArch -ne "AMD64" -and $buildVersion -lt 22000) {
|
if ($item.Name -Match "x64" -and $procArch -ne "AMD64" -and $buildVersion -lt 22000) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
$outFile = Join-Path $tempDir $item.Name
|
if ($item.Name -Match "directx" -and $isServer) {
|
||||||
Write-Host "Downloading $($item.Name)..."
|
continue
|
||||||
$argumentList = @(
|
|
||||||
"--dir=`"$($outFile | Split-Path)`"",
|
|
||||||
"--out=`"$(Split-Path -Leaf $outFile)`"",
|
|
||||||
"--allow-overwrite=true",
|
|
||||||
"--retry-wait=5",
|
|
||||||
"--max-connection-per-server=8",
|
|
||||||
"--split=8",
|
|
||||||
"--min-split-size=1M",
|
|
||||||
"`"$($item.Url)`""
|
|
||||||
)
|
|
||||||
if (![string]::IsNullOrEmpty($regionalWorkaround)) {
|
|
||||||
$argumentList += $regionalWorkaround
|
|
||||||
}
|
|
||||||
$proc = Start-Process -FilePath $aria2Exe -ArgumentList $argumentList -NoNewWindow -PassThru -Wait
|
|
||||||
if ($proc.ExitCode -ne 0) {
|
|
||||||
Write-Warning "aria2c failed (exit code $($proc.ExitCode)). Retrying with --check-certificate=false..."
|
|
||||||
$argsRetry = $argumentList + "--check-certificate=false"
|
|
||||||
Start-Process -FilePath $aria2Exe -ArgumentList $argsRetry -NoNewWindow -Wait
|
|
||||||
}
|
}
|
||||||
|
$line = "$($item.Url)`n out=$($item.Name)"
|
||||||
|
Add-Content -Path $ariaListPath -Value $line
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host "Downloading files..."
|
||||||
|
$argumentList = @(
|
||||||
|
"--dir=`"$($outFile | Split-Path)`"",
|
||||||
|
"--out=`"$(Split-Path -Leaf $outFile)`"",
|
||||||
|
"--allow-overwrite=true",
|
||||||
|
"--retry-wait=5",
|
||||||
|
"--max-connection-per-server=8",
|
||||||
|
"--split=8",
|
||||||
|
"--min-split-size=1M",
|
||||||
|
"-i `"$ariaListPath`""
|
||||||
|
)
|
||||||
|
if (![string]::IsNullOrEmpty($regionalWorkaround)) {
|
||||||
|
$argumentList += $regionalWorkaround
|
||||||
|
}
|
||||||
|
$proc = Start-Process -FilePath $aria2Exe -ArgumentList $argumentList -NoNewWindow -PassThru -Wait
|
||||||
|
if ($proc.ExitCode -ne 0) {
|
||||||
|
Write-Warning "aria2c failed (exit code $($proc.ExitCode)). Retrying with --check-certificate=false..."
|
||||||
|
$argsRetry = $argumentList + "--check-certificate=false"
|
||||||
|
Start-Process -FilePath $aria2Exe -ArgumentList $argsRetry -NoNewWindow -Wait
|
||||||
}
|
}
|
||||||
|
|
||||||
# --- Check Signature ---
|
# --- Check Signature ---
|
||||||
|
|
@ -172,9 +191,11 @@ function Main {
|
||||||
}
|
}
|
||||||
|
|
||||||
# --- Install DirectX ---
|
# --- Install DirectX ---
|
||||||
Write-Host "Installing DirectX..."
|
if (-not $isServer) {
|
||||||
Start-Process -FilePath "$tempDir\directx_redist.exe" -ArgumentList "/Q /T:`"$tempDir`"" -Wait
|
Write-Host "Installing DirectX..."
|
||||||
Start-Process -FilePath "$tempDir\DXSETUP.exe" -ArgumentList "/silent" -Wait
|
Start-Process -FilePath "$tempDir\directx_redist.exe" -ArgumentList "/Q /T:`"$tempDir`"" -Wait
|
||||||
|
Start-Process -FilePath "$tempDir\DXSETUP.exe" -ArgumentList "/silent" -Wait
|
||||||
|
}
|
||||||
|
|
||||||
# --- Install VC++ Redistributables ---
|
# --- Install VC++ Redistributables ---
|
||||||
foreach ($item in $downloads | Where-Object { $_.Name -like "vcredist*" }) {
|
foreach ($item in $downloads | Where-Object { $_.Name -like "vcredist*" }) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue