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
16
32
16
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,10 +97,15 @@ 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
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host "Downloading files..."
|
||||||
$argumentList = @(
|
$argumentList = @(
|
||||||
"--dir=`"$($outFile | Split-Path)`"",
|
"--dir=`"$($outFile | Split-Path)`"",
|
||||||
"--out=`"$(Split-Path -Leaf $outFile)`"",
|
"--out=`"$(Split-Path -Leaf $outFile)`"",
|
||||||
|
|
@ -105,7 +114,7 @@ function Main {
|
||||||
"--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
|
||||||
|
|
@ -116,7 +125,6 @@ function Main {
|
||||||
$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 ---
|
||||||
foreach ($item in $downloads) {
|
foreach ($item in $downloads) {
|
||||||
|
|
|
||||||
17
64
17
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,13 +115,15 @@ 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)`"",
|
||||||
|
|
@ -126,7 +132,7 @@ function Main {
|
||||||
"--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
|
||||||
|
|
@ -137,7 +143,6 @@ function Main {
|
||||||
$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 ---
|
||||||
foreach ($item in $downloads) {
|
foreach ($item in $downloads) {
|
||||||
|
|
|
||||||
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 }
|
||||||
|
|
|
||||||
29
index.html
29
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,13 +122,21 @@ 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
|
||||||
|
}
|
||||||
|
$line = "$($item.Url)`n out=$($item.Name)"
|
||||||
|
Add-Content -Path $ariaListPath -Value $line
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host "Downloading files..."
|
||||||
$argumentList = @(
|
$argumentList = @(
|
||||||
"--dir=`"$($outFile | Split-Path)`"",
|
"--dir=`"$($outFile | Split-Path)`"",
|
||||||
"--out=`"$(Split-Path -Leaf $outFile)`"",
|
"--out=`"$(Split-Path -Leaf $outFile)`"",
|
||||||
|
|
@ -125,7 +145,7 @@ function Main {
|
||||||
"--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
|
||||||
|
|
@ -136,7 +156,6 @@ function Main {
|
||||||
$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 ---
|
||||||
foreach ($item in $downloads) {
|
foreach ($item in $downloads) {
|
||||||
|
|
@ -172,9 +191,11 @@ function Main {
|
||||||
}
|
}
|
||||||
|
|
||||||
# --- Install DirectX ---
|
# --- Install DirectX ---
|
||||||
|
if (-not $isServer) {
|
||||||
Write-Host "Installing DirectX..."
|
Write-Host "Installing DirectX..."
|
||||||
Start-Process -FilePath "$tempDir\directx_redist.exe" -ArgumentList "/Q /T:`"$tempDir`"" -Wait
|
Start-Process -FilePath "$tempDir\directx_redist.exe" -ArgumentList "/Q /T:`"$tempDir`"" -Wait
|
||||||
Start-Process -FilePath "$tempDir\DXSETUP.exe" -ArgumentList "/silent" -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