From 1d1078798f453b1c619ce459fb1d50ab3c849e1c Mon Sep 17 00:00:00 2001 From: ThioJoe <12518330+ThioJoe@users.noreply.github.com> Date: Mon, 4 Aug 2025 19:00:47 -0700 Subject: [PATCH] Add Install VC Redistributables script --- Installer Scripts/Install VC Redist.ps1 | 38 +++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 Installer Scripts/Install VC Redist.ps1 diff --git a/Installer Scripts/Install VC Redist.ps1 b/Installer Scripts/Install VC Redist.ps1 new file mode 100644 index 0000000..df2d959 --- /dev/null +++ b/Installer Scripts/Install VC Redist.ps1 @@ -0,0 +1,38 @@ +# URLs for the latest Visual C++ Redistributables +$urls = @( + "https://aka.ms/vs/17/release/vc_redist.x86.exe", + "https://aka.ms/vs/17/release/vc_redist.x64.exe" +# "https://aka.ms/vs/17/release/vc_redist.arm64.exe" # Uncomment if using Arm64 device + +) + +# Directory to save the downloads +$downloadPath = "$env:TEMP" + +# To improve download performance, the progress bar is suppressed. [2, 6] +$ProgressPreference = 'SilentlyContinue' + +foreach ($url in $urls) { + $fileName = $url.Split('/')[-1] + $filePath = Join-Path $downloadPath $fileName + + Write-Host "Downloading $fileName..." + # Download the file without a progress bar [1, 4] + Invoke-WebRequest -Uri $url -OutFile $filePath + + if (Test-Path $filePath) { + Write-Host "Installing $fileName..." + # Silently install the redistributable and wait for it to complete [3, 5, 9] + Start-Process -FilePath $filePath -ArgumentList "/install /quiet /norestart" -Wait + Write-Host "$fileName has been installed." + # Optional: Remove the installer after installation + # Remove-Item -Path $filePath + } else { + Write-Host "Error: Failed to download $fileName." + } +} + +# Restore the default progress preference +$ProgressPreference = 'Continue' + +Write-Host "Script execution finished."